-
Notifications
You must be signed in to change notification settings - Fork 581
HDDS-13311. Directory Deleting Service can use deleteRange for subDirectories and subFiles #9423
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
base: master
Are you sure you want to change the base?
Conversation
…subDirectories and subFiles.
swamirishi
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.
thanks for the patch @aryangupta1998 Change this one fix I am reviewing other parts in the meanwhile
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Outdated
Show resolved
Hide resolved
|
Please wait for clean CI run in fork before opening PR. |
swamirishi
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.
@aryangupta1998 please add unit tests for KeyManagerImpl and DirectoryDeletingService changes
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/KeyManagerImpl.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/KeyManagerImpl.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
| if (startKey != null) { | ||
| keyRanges.add(new DeleteKeysResult.ExclusiveRange(startKey, lastLoopExclusiveKey)); | ||
| } | ||
| return new DeleteKeysResult(keyInfos, keyRanges, processedAllKeys); |
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 (startKey != null) { | |
| keyRanges.add(new DeleteKeysResult.ExclusiveRange(startKey, lastLoopExclusiveKey)); | |
| } | |
| return new DeleteKeysResult(keyInfos, keyRanges, processedAllKeys); | |
| boolean processedAllKeys = iterator.hasNext(); | |
| if (startKey != null) { | |
| keyRanges.add(new DeleteKeysResult.ExclusiveRange(startKey, processedAllKeys ? getLexicographicallyHigherString(seekFileInDB) : iterator.next().getKey())); | |
| } | |
| return new DeleteKeysResult(keyInfos, keyRanges, processedAllKeys); |
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 should be boolean processedAllKeys = !iterator.hasNext();
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java
Outdated
Show resolved
Hide resolved
| private PurgePathRequest wrapPurgeRequest( | ||
| final long volumeId, final long bucketId, final String purgeDeletedDir, | ||
| final List<OmKeyInfo> purgeDeletedFiles, final List<OmKeyInfo> markDirsAsDeleted) { | ||
| return wrapPurgeRequest( |
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.
why is this needed?
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.
Two helper functions don't require ranges, and my added tests require a range parameter, which is why it's needed.
|
@aryangupta1998 Don't make it ready for review until you get a +1 from reviewers |
What changes were proposed in this pull request?
DirectoryDeletingService should use rocksdb deleteRange instead of creating individual tombstones which can cause seek time issue. But in the presence of snapshots the deleteRange APi should stitch continuous key ranges together that are reclaimable and not issue a blind deleteRange which could lead to incorrect reclaimation of the entry and lead to unreference orphan blocks when the snapshots are deleted.
DeleteRange APIs on FileTable, DirectoryTable, KeyTable can be used by background garbage collection services and should never be used by user facing APIs like keyDelete as that can cause issues in snapshot correctness.
E.g.
Then DirectoryDeletingService should issue 2 delete range like
[Dir1/Key1..Dir1/Key2] (Both inclusive)
[Dir1/Key4..Dir1/Key5]
In terms of rocksdb deleteRange where the end key range is exclusive this would be equivalent to
[Dir1/Key1..Dir1/Key3) and [Dir1/Key4..lexicographicalHigherString(Dir1/)]
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13311
How was this patch tested?
Testes via UT.