-
Notifications
You must be signed in to change notification settings - Fork 587
HDDS-2424. Add the recover-trash command server side handling. #399
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
Conversation
maobaolong
left a comment
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.
Look good overall, just some minor comments left.
| public boolean recoverTrash(String volumeName, String bucketName, | ||
| String keyName, String destinationBucket) throws IOException { | ||
|
|
||
| Preconditions.checkNotNull(volumeName); |
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.
Not sure the @nonnull is a better way? I saw the Nonnull annotation in the hadoop-ozone project already, and findbugs will find null argument during build.
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 @maobaolong for this advice.
As I know, we could use both @Nonnull and Preconditions.checkNotNull(), and the former is to inform developer not use null in the parameter, and the later is to validate in runtime.
So, I think this part would not be fixed,
and we could create a Jira for the annotation issue. HDDS-2824
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.
ok
| public boolean recoverTrash(String volumeName, String bucketName, | ||
| String keyName, String destinationBucket) throws IOException { | ||
|
|
||
| // TODO: core logic stub would be added in later patch. |
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.
Maybe we need a JIRA tickets track this item?
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 @maobaolong for the suggestion.
Yeah, there are HDDS-2425 and HDDS-2426 that tracked this item.
Updated.
| String destinationBucket = "destBucket"; | ||
| createAndDeleteKey(keyName); | ||
|
|
||
| /* TODO:HDDS-2424. */ |
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.
Yeah, what i means is like this TODO comment.
|
Recover trash is a write request command as this moves the keys from the delete table to the original key table. let me know if I am missing something here. 2 comments.
As for write request commands, we should follow HA kind of request implementation. For reference this design link write link |
bharatviswa504
left a comment
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.
One General question I have on the PR approach.
Thank you @bharatviswa504 for the document. |
|
Thanks @bharatviswa504 for the document. The |
|
@bharatviswa504 Can we commit this PR? |
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManager.java
Outdated
Show resolved
Hide resolved
| omKeyInfo = OmUtils.prepareKeyForRecover(omKeyInfo, repeatedOmKeyInfo); | ||
| omMetadataManager.getDeletedTable() | ||
| .deleteWithBatch(batchOperation, omKeyInfo.getKeyName()); | ||
| /* TODO: trashKey should be updated to destinationBucket. */ |
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.
One question:
- if the key is created, deleted, the key is created and the key is deleted. Now when recover, which omKeyInfo will be used from the delete table.
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.
Thank you @bharatviswa504 for the question.
Refer to processing of DeletedTable in OMKeyDeleteResponse#addToDBBatch() and OmUtils#prepareKeyForDelete(), the latest deleted key is added in tail of RepeatedOmKeyInfo#omKeyInfoList.
So I think we could recover the latest deleted key from the DeletedTable in this created-deleted-created-deleted situation. (And when recovering the latest key, I think we should clear the old deleted key.)
Would you please give me advice if I miss something ?
If the idea is proper, I will update the description of this jira.
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 am fine with recovering last delete key if that is the expected behavior.
(And when recovering the latest key, I think we should clear the old deleted key.)
We should not delete the other keys, as those keys will be picked by background trash service and the data for those keys need to be deleted.
And also doing this way, is also not correct from my understanding, let us say, we put those keys in delete table, and background delete key service will pick them up and send to SCM for deletion, at this point we got a recover trash command, so there is a chance that we recover the key which might have no data, as we submitted the request to SCM for deletion, and SCM, in turn, it will send to DN. How we shall handle this kind of scenarios?
Because deletion from delete table will happen when key purge request happens.
Code snippet link #link
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.
/pending I'm tracing the background part. (Hope soon)
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.
Thank you @bharatviswa504 for taking time to review this.
Here is my thought,
We set modificationTime when deleting key.
So I think we can compare the modificationTime with RECOVERY_WINDOW to exclude keys(exist in trash-enabled buckets) from purging.
Code snippet would be added after this line might like
if (trashEnable(info.getBucketName()) &&
(Time.now() - info.getModificationTime()) < RECOVERY_WINDOW) {
/* Would not delete key in this situation. */
}note recovery_window of bucket would be added in later Jira.
Could you please give me your thoughts or ideas if I miss something, thank you.
And here is discussion about trash-recovery.
...zone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMTrashRecoverRequest.java
Outdated
Show resolved
Hide resolved
...ne-manager/src/main/java/org/apache/hadoop/ozone/om/response/key/OMTrashRecoverResponse.java
Show resolved
Hide resolved
bharatviswa504
left a comment
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.
Few comments inline.
Thank You @cxorm for the update.
|
/pending Comments from @bharatviswa504 are not addressed, yet... |
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.
Marking this issue as un-mergeable as requested.
Please use /ready comment when it's resolved.
Comments from @bharatviswa504 are not addressed, yet...
|
@bharatviswa504 Can you please check it? |
|
@elek There are some pending comments which need to be resolved. |
749714e to
6c0fa96
Compare
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.
@bharatviswa504
What do you think about this cleanup write-request ?
Could we set the write-operation with a default or
we need a separated interface addressed the write-operation ?
|
@cxorm , can you plz update the pr? |
|
@bharatviswa504 , can you please have a look? |
|
Thanks @bshashikant for the reminder. |
|
Rebase latest master-branch (#839) to resolve conflict. |
|
Rebase latest master-branch (#848) and trigger github-actions. |
|
Thanks @cxorm for working on this. I have committed this. |
|
Thanks @bharatviswa504 for the review |
What changes were proposed in this pull request?
This PR was created for adding the server side of recover-trash.
Components updated including (in propagation order.)
OzoneManagerandOzoneManagerRequestHandlerKeyManagerand its implementationOMMetadataManagerand its implementationOther fixes would be completed in HDDS-2425 and HDDS-2426
(Including
startKeyandprefix)Note
Cause
recoverTrashis write request, we should handle the request with OMHA.With this doc, we use
late validationto handle write request.This PR mainly has parts including updating
OzoneManagerandfixing
OzoneManagerProtocolClientSideTranslatorPBas well asOMTrashRecoverRequestandOMTrashRecoverResponseto handle request of write type.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-2424
How was this patch tested?
Cause only adding the server side handling.
Just tested the propagation and ran the UT.