HDDS-13311. Directory Deleting Service can use deleteRange for subDirectories and subFiles#9423
HDDS-13311. Directory Deleting Service can use deleteRange for subDirectories and subFiles#9423aryangupta1998 wants to merge 14 commits intoapache:masterfrom
Conversation
…subDirectories and subFiles.
swamirishi
left a comment
There was a problem hiding this comment.
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.
@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
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java
Outdated
Show resolved
Hide resolved
...st/java/org/apache/hadoop/ozone/om/request/key/TestOMDirectoriesPurgeRequestAndResponse.java
Show resolved
Hide resolved
|
@aryangupta1998 Don't make it ready for review until you get a +1 from reviewers |
sumitagrawl
left a comment
There was a problem hiding this comment.
@aryangupta1998 It seems not feasible to use delete range, as parallel new item can get added in middle within range, and can delete those unexpected entry.
cc: @swamirishi
...src/main/java/org/apache/hadoop/ozone/om/response/key/OMDirectoriesPurgeResponseWithFSO.java
Show resolved
Hide resolved
swamirishi
left a comment
There was a problem hiding this comment.
Please add unit tests with mocking layer
...ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerDeleteRanges.java
Outdated
Show resolved
Hide resolved
ashishkumar50
left a comment
There was a problem hiding this comment.
@aryangupta1998 Thanks for working on this, can you also add a metric to specify deleteRange requests.
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/DeleteKeysResult.java
Outdated
Show resolved
Hide resolved
...ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerDeleteRanges.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/hadoop/ozone/om/response/key/OMDirectoriesPurgeResponseWithFSO.java
Show resolved
Hide resolved
...src/main/java/org/apache/hadoop/ozone/om/response/key/OMDirectoriesPurgeResponseWithFSO.java
Outdated
Show resolved
Hide resolved
| validateNonOverlappingRanges(); | ||
| } | ||
|
|
||
| private void validateNonOverlappingRanges() { |
There was a problem hiding this comment.
nit: Pass keyRanges in the argument this might throw NPE if someone moves this method in the constructor later on
There was a problem hiding this comment.
Do we actually need this validation? Things need not be always sorted it depends on the rocksdb bytewise comparator order. Rocksdb would guarantee us that already
There was a problem hiding this comment.
@ashishkumar50,
In Ozone, RocksDB uses the default bytewise comparator, which compares keys by their raw byte sequence, so string keys are stored and returned in lexicographically sorted order. That means the ranges we construct from the iterator are already ordered. Also, the deleteRangeWithBatch() API treats the end key as exclusive, so even in the corner case where endKey = getLexicographicallyHigherString(path) for one range and the next iterator entry yields startKey = getLexicographicallyHigherString(path), the ranges do not overlap ([start, end) then [end, …)), which is safe. Based on this, I removed validateNonOverlappingRanges(), as RocksDB’s ordering plus our range construction logic already guarantees non‑overlapping, sorted ranges.
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/DeleteKeysResult.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/DeleteKeysResult.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/DeleteKeysResult.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/DeleteKeysResult.java
Outdated
Show resolved
Hide resolved
|
We need to wait for #9553 since deleteRange patch has been reverted |
|
This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days. |
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.