Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Fileid.filestats.hawq1721 #1453

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion depends/libhdfs3/src/client/FileStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FileStatus {
public:
FileStatus() :
isdir(false), atime(0), blocksize(0), length(0), mtime(
0), permission(0644), replications(0) {
0), permission(0644), replications(0), fileid(0) {
}

int64_t getAccessTime() const {
Expand Down Expand Up @@ -159,6 +159,18 @@ class FileStatus {
return fileEncryption.getKey().length() > 0 && fileEncryption.getKeyName().length() > 0;
}

/**
* Get FileID of hdfs file/directory
* @return fileid of file if present, else 0
*/
int64_t getFileid() const {
return fileid;
}

void setFileid(int64_t fileid) {
this->fileid = fileid;
}

private:
bool isdir;
int64_t atime;
Expand All @@ -172,6 +184,7 @@ class FileStatus {
std::string path;
std::string symlink;
FileEncryptionInfo fileEncryption;
int64_t fileid;
};

}
Expand Down
1 change: 1 addition & 0 deletions depends/libhdfs3/src/client/Hdfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ static void ConstructHdfsFileInfo(hdfsFileInfo * infos,
infos[i].mPermissions = status[i].getPermission().toShort();
infos[i].mReplication = status[i].getReplication();
infos[i].mSize = status[i].getLength();
infos[i].mFileid = status[i].getFileid();
infos[i].mHdfsEncryptionFileInfo = NULL;
if (status[i].isFileEncrypted()) {
infos[i].mHdfsEncryptionFileInfo = new hdfsEncryptionFileInfo[1];
Expand Down
1 change: 1 addition & 0 deletions depends/libhdfs3/src/client/hdfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ typedef struct {
short mPermissions; /* the permissions associated with the file */
tTime mLastAccess; /* the last access time for the file in seconds */
hdfsEncryptionFileInfo * mHdfsEncryptionFileInfo; /* the encryption info of the file/directory */
tOffset mFileid; /* Fileid associated with a file. Default value is 0*/
} hdfsFileInfo;

/**
Expand Down
1 change: 1 addition & 0 deletions depends/libhdfs3/src/server/RpcHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static inline void Convert(const std::string & src, FileStatus & fs,
fs.setSymlink(proto.symlink().c_str());
fs.setPermission(Permission(proto.permission().perm()));
fs.setIsdir(proto.filetype() == HdfsFileStatusProto::IS_DIR);
fs.setFileid(proto.fileid());

if (proto.has_fileencryptioninfo()){
const FileEncryptionInfoProto &encrypt = proto.fileencryptioninfo();
Expand Down