Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Is there a way that inotify createEvent can capture the name of the created file?

avatar
Contributor

Hi Guys, I am writing a hdfs hook works with the apache atlas, but the atlas hdfs_path type requires the name of the hdfs file, I am currently working with the inotify api but cannot find a way to capture the name of the created file, do you guys have any idea about this?

1 ACCEPTED SOLUTION

avatar
Rising Star

Not sure if I got your question right,

the CreateEvent will contain the HDFS path. The name of the file is part of the HDFS path (comes after the last '/'). I hope this answers your question.

see the inotify patch here, https://issues.apache.org/jira/secure/attachment/12665452/HDFS-6634.9.patch#file-8

/**
* Sent when a new file is created (including overwrite).
*/
public static class CreateEvent extends Event {


public static enum INodeType {
  FILE, DIRECTORY, SYMLINK;
}


private INodeType iNodeType;
private String path;
private long ctime;
private int replication;
private String ownerName;
private String groupName;
private FsPermission perms;
private String symlinkTarget;

View solution in original post

2 REPLIES 2

avatar
Rising Star

Not sure if I got your question right,

the CreateEvent will contain the HDFS path. The name of the file is part of the HDFS path (comes after the last '/'). I hope this answers your question.

see the inotify patch here, https://issues.apache.org/jira/secure/attachment/12665452/HDFS-6634.9.patch#file-8

/**
* Sent when a new file is created (including overwrite).
*/
public static class CreateEvent extends Event {


public static enum INodeType {
  FILE, DIRECTORY, SYMLINK;
}


private INodeType iNodeType;
private String path;
private long ctime;
private int replication;
private String ownerName;
private String groupName;
private FsPermission perms;
private String symlinkTarget;

avatar
Contributor

Thanks for your reply, I just realize this is a stupid question lol