Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: improve the rename performance. #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yuyang733
Copy link
Collaborator

No description provided.

@yuyang733 yuyang733 force-pushed the perf-improve_rename_performance branch from 0a8510c to 2806d10 Compare March 20, 2025 14:26
@yuyang733 yuyang733 force-pushed the perf-improve_rename_performance branch from 2806d10 to afbdde5 Compare March 20, 2025 14:59
} else {
result = this.copyFile(srcPath, dstPath);
result = this.copyFile(srcPath, destPath);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src是不是也可以用status


Pair<CosNFileStatus, CosNFileStatus> renameFileStatusPair = new Pair<>();

// Hadoop FileSystem Specification: if not exists(FS, src) : raise FileNotFoundException
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the source file src does not exist, FileNotFoundException should be raised.
HDFS fails without raising an exception; rename() merely returns false.
false -> notfound 兼容性要测下

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗯,这里要测试下

if (dstFileStatus.isFile()) {
LOG.debug("File: {} already exists.", dstFileStatus.getPath());
return false;
throw new FileAlreadyExistsException(dstPath.toString());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming a file atop an existing file is specified as failing, raising an exception.
HDFS : The rename fails, no exception is raised. Instead the method call simply returns false.
兼容性?

}

@Override
public int hashCode() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for what?

// For symlink types, the Hadoop file system specification does not provide clear instructions,
// I tested the soft connection in the POSIX file system, and the same behavior is also true.
return true;
}
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dst&src 都为空?上面不有checknull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants