-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[ALLUXIO-3063] Support recursive ufs sync #6699
Conversation
Merged build finished. Test PASSed. |
Test PASSed. |
Automated checks report:
All checks passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is the ufs sync not binary (ie. recursive or not recursive) but rather recursive up to a certain depth? I'm wondering if we can change the numerical value to a boolean.
listStatus = ufs.listStatus(ufsUri.toString()); | ||
} catch (IOException e) { | ||
// ignore error | ||
LOG.warn("Failed to list directory: {} error: {}", ufsUri, e.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this message need more detail, since we list in many places and why it is a harmless error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually changed the error model a little bit. Ultimately, I didn't want the sync to throw an exception. So, this internal method will throw any exception, and the caller, syncMetadata()
, will print out an error and return false
.
} | ||
|
||
if (listStatus != null) { | ||
// maps children name to ufs fingerprint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to the most up to date ufs fingerprint
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this. Glad to see the master-side changes weren't too extensive. I think it might be cleaner to use a NONE|ALL|ONE_LEVEL enum to represent how to sync/loadMetadata, but you can decide which way you prefer it.
status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(fileB))); | ||
Assert.assertEquals(ttl, status.getTtl()); | ||
|
||
// deleted UFS file should not exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mFileSystem.exists()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
writeUfsFile(ufsPath(fileA), 1); | ||
writeUfsFile(ufsPath(fileB), 1); | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mFileSystem.exists()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
for (UfsStatus childStatus : children) { | ||
boolean skipExisting = inode.getChild(childStatus.getName()) != null; | ||
// Do not skip existing directories if there are more descendant levels to load | ||
if (childStatus.isDirectory() && (options.getLoadDescendantLevels() < 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be simpler to have two independent if-continue statements and avoid the need for skipExisting
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
continue; | ||
} | ||
TempInodePathForChild tempInodePath = | ||
new TempInodePathForChild(inodePath, status.getName()); | ||
new TempInodePathForChild(inodePath, childStatus.getName()); | ||
int loadDescendantLevels = options.getLoadDescendantLevels(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we declare/update this value earlier, we only need to check loadDescendentLevels != 0
on line 2450
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was already restructured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@calvinjia @aaudiber Thanks! I updated the PR.
I made the descendant type into an Enum.
listStatus = ufs.listStatus(ufsUri.toString()); | ||
} catch (IOException e) { | ||
// ignore error | ||
LOG.warn("Failed to list directory: {} error: {}", ufsUri, e.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually changed the error model a little bit. Ultimately, I didn't want the sync to throw an exception. So, this internal method will throw any exception, and the caller, syncMetadata()
, will print out an error and return false
.
} | ||
|
||
if (listStatus != null) { | ||
// maps children name to ufs fingerprint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
writeUfsFile(ufsPath(fileA), 1); | ||
writeUfsFile(ufsPath(fileB), 1); | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
status = mFileSystem.getStatus(new AlluxioURI(alluxioPath(fileB))); | ||
Assert.assertEquals(ttl, status.getTtl()); | ||
|
||
// deleted UFS file should not exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
for (UfsStatus childStatus : children) { | ||
boolean skipExisting = inode.getChild(childStatus.getName()) != null; | ||
// Do not skip existing directories if there are more descendant levels to load | ||
if (childStatus.isDirectory() && (options.getLoadDescendantLevels() < 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
continue; | ||
} | ||
TempInodePathForChild tempInodePath = | ||
new TempInodePathForChild(inodePath, status.getName()); | ||
new TempInodePathForChild(inodePath, childStatus.getName()); | ||
int loadDescendantLevels = options.getLoadDescendantLevels(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was already restructured.
Merged build finished. Test PASSed. |
Test PASSed. |
https://alluxio.atlassian.net/browse/ALLUXIO-3063