-
Notifications
You must be signed in to change notification settings - Fork 509
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
HDDS-10010. Support snapshot rename operation #6006
Conversation
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 the patch @Cyrill.
I looked at briefly and the only two major concerns I've are
- Snapshot chain manager needs to be updated.
- SnapshotCache: currently snapshotCache used /volName/bucketName/snapshotName as key for the cache. When we do a rename, we may need to update the cache as well. Or we can think if we should use snapshotId for it.
Afair, SnapshotDiff uses SnapshotId and snapshot rename should not be a problem there but it would be great if you can double check that part as well.
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotRenameRequest.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotRenameRequest.java
Outdated
Show resolved
Hide resolved
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.
My main concern with snapshot renaming is SnapshotCache. Currently SnapshotName is used as key in SnapshotCache.
Invalidating cache for snapshot rename doesn't make sense to me. Invalidate should only be used when snapshot is purged. Also invalidating cache for active snapshot will impact background service (KeyDeletingService, SSTFilteringService, SnapshotDeletingService, and SnapDiff).
To me better approach would be to use SnapshotId as key in SnapshotCache. This change could be a follow up task. I'm to other suggestion as well.
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/client/ClientProtocolStub.java
Outdated
Show resolved
Hide resolved
...-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/RenameSnapshotHandler.java
Outdated
Show resolved
Hide resolved
|
||
updateSnapshotInChainManager(omMetadataManager, snapshotOldInfo); | ||
|
||
ozoneManager.getOmSnapshotManager().getSnapshotCache().invalidate(snapshotOldTableKey); |
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 don't think it is good idea to invalidate the cache because of snapshot rename. I guess better approach would be to use snapshotId as key for snapshotCache.
- Unit test is failing due to NPE in this line. Please take a look of that.
Error: Tests run: 13, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.973 s <<< FAILURE! -- in org.apache.hadoop.ozone.om.request.snapshot.TestOMSnapshotRenameRequest
Error: org.apache.hadoop.ozone.om.request.snapshot.TestOMSnapshotRenameRequest.testValidateAndUpdateCache -- Time elapsed: 0.178 s <<< ERROR!
java.lang.NullPointerException
at org.apache.hadoop.ozone.om.request.snapshot.OMSnapshotRenameRequest.validateAndUpdateCache(OMSnapshotRenameRequest.java:192)
at org.apache.hadoop.ozone.om.request.OMClientRequest.validateAndUpdateCache(OMClientRequest.java:145)
at org.apache.hadoop.ozone.om.request.snapshot.TestOMSnapshotRenameRequest.testValidateAndUpdateCache(TestOMSnapshotRenameRequest.java:217)
at java.lang.reflect.Method.invoke(Method.java:498)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at java.util.ArrayList.forEach(ArrayList.java:1259
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
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.
- Removed the cache invalidate call here
...nager/src/main/java/org/apache/hadoop/ozone/om/request/snapshot/OMSnapshotRenameRequest.java
Outdated
Show resolved
Hide resolved
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 took a quick look at the patch. My main concern is similar to what @hemantk-12 suggested, There is KeyDeletingService
, SnapshotDirectoryCleanupService
and the OM requests used by this services pass the snapshot name in the request to OM to identify the snapshot. If a rename happened in between these requests this may cause undefined behaviour.
I would suggest changing these other classes as well to use snapshotId instead of snapshot name is the way to go forward.
Hi @hemantk-12, are there any more changes required for this PR to move forward? |
@hemantk-12 @aswinshakil Is there any chance to help me with moving this PR forward? |
@Cyrill I was busy with other stuff last week and didn't get chance to look into this. LGTM. |
What changes were proposed in this pull request?
HDDS-10010. Support snapshot rename operation
Ozone implements org.apache.hadoop.fs.FileSystem, which has three methods to work with snapshots - create, rename and delete. Only create and delete are implemented at the moment.
Implementing snapshot rename will improve Ozone compatibility with other software (that uses snapshots functionality).
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10010
How was this patch tested?
Tested with unit tests an manual testing.