-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-11508. Decouple delete batch limits from Ratis request size for DirectoryDeletingService. #7365
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
…DirectoryDeletingService.
|
Thanks for working on this @sadanand48. Are you planning to handle this for SCM block deletion and other OM services in another PR? In that case maybe we should file the PRs under sub-jiras of the original HDDS-11508 Jira for easier tracking. |
Sure, will create sub tasks for these when the current one is fixed. |
|
Sounds good, I think that will help with reviews too. In that case, let's use a new Jira for this PR and resolve HDDS-11508 once all the subtasks and their PRs are complete. |
|
@sadanand48 HDDS-11605 introduced some conflicts, can you please update the PR? |
sumitagrawl
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.
@sadanand48 Thanks for working over this, have few minor comments...
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java
Outdated
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/service/AbstractKeyDeletingService.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Outdated
Show resolved
Hide resolved
@sumitagrawl @errose28 Could you please review this ? I have implemented the above suggestion and only used ratis size as the limit for sending a delete request. |
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/DeleteKeysResult.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OMMetrics.java
Outdated
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/service/AbstractKeyDeletingService.java
Outdated
Show resolved
Hide resolved
...one-manager/src/main/java/org/apache/hadoop/ozone/om/service/AbstractKeyDeletingService.java
Outdated
Show resolved
Hide resolved
...ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java
Show resolved
Hide resolved
sumitagrawl
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.
@sadanand48 We can remove the configuration and unused default value and variables. Other logic LGTM.
sumitagrawl
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.
LGTM +1
aryangupta1998
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, @sadanand48, and @sumitagrawl for the review, LGTM!
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.
Sorry for the late review, but I just noticed this potential performance problem:
ozone/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java
Lines 608 to 612 in 24aab04
| CodecBuffer keyCodecBuffer = raw.getKey(); | |
| final KEY key = keyCodec.fromCodecBuffer(keyCodecBuffer); | |
| CodecBuffer valueCodecBuffer = raw.getValue(); | |
| final VALUE value = valueCodec.fromCodecBuffer(valueCodecBuffer); | |
| return Table.newKeyValue(key, value, keyCodecBuffer.getArray(), valueCodecBuffer.getArray()); |
This creates byte[] copy of raw key and value:
ozone/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java
Lines 357 to 365 in 24aab04
| /** | |
| * @return a new array containing the readable bytes. | |
| * @see #readableBytes() | |
| */ | |
| public byte[] getArray() { | |
| final byte[] array = new byte[readableBytes()]; | |
| buf.readBytes(array); | |
| return array; | |
| } |
Raw key is never used, raw value is used only for getting serialized size:
ozone/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Line 2105 in 24aab04
| long objectSerializedSize = entry.getRawValue().length; |
ozone/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
Line 2152 in 24aab04
| long objectSerializedSize = entry.getRawValue().length; |
We can get serialized size without allocating new arrays:
ozone/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/CodecBuffer.java
Lines 339 to 342 in 24aab04
| /** @return the number of bytes can be read. */ | |
| public int readableBytes() { | |
| return buf.readableBytes(); | |
| } |
I think getRawKey and getRawValue should be replaced.
Note that the conversion affects all iterators, not just the deleting service.
|
Sure thanks @adoroszlai , will open a jira to handle this and raise a PR. |
|
Thanks @sadanand48, I have created HDDS-12186, now assigned to you. |
* master: (168 commits) HDDS-12112. Fix interval used for Chunk Read/Write Dashboard (apache#7724) HDDS-12212. Fix grammar in decommissioning and observability documentation (apache#7815) HDDS-12195. Implement skip() in OzoneFSInputStream (apache#7801) HDDS-12200. Fix grammar in OM HA, EC and Snapshot doc (apache#7806) HDDS-12202. OpsCreate and OpsAppend metrics not incremented (apache#7811) HDDS-12203. Initialize block length before skip (apache#7809) HDDS-12183. Reuse cluster across safe test classes (apache#7793) HDDS-11714. resetDeletedBlockRetryCount with --all may fail and can cause long db lock in large cluster. (apache#7665) HDDS-12186. (addendum) Avoid array allocation for table iterator (apache#7799) HDDS-12186. Avoid array allocation for table iterator. (apache#7797) HDDS-11508. Decouple delete batch limits from Ratis request size for DirectoryDeletingService. (apache#7365) HDDS-12073. Don't show Source Bucket and Volume if null in DU metadata (apache#7760) HDDS-12142. Save logs from build check (apache#7782) HDDS-12163. Reduce number of individual getCapacity/getAvailable/getUsedSpace calls (apache#7790) HDDS-12176. Trivial dependency cleanup.(apache#7787) HDDS-12181. Bump jline to 3.29.0 (apache#7789) HDDS-12165. Refactor VolumeInfoMetrics to use getCurrentUsage (apache#7784) HDDS-12085. Add manual refresh button for DU page (apache#7780) HDDS-12132. Parameterize testUpdateTransactionInfoTable for SCM (apache#7768) HDDS-11277. Remove dependency on hadoop-hdfs in Ozone client (apache#7781) ... Conflicts: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeConfiguration.java hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java hadoop-ozone/dist/src/main/smoketest/admincli/container.robot hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ClosedContainerReplicator.java
* master: (168 commits) HDDS-12112. Fix interval used for Chunk Read/Write Dashboard (apache#7724) HDDS-12212. Fix grammar in decommissioning and observability documentation (apache#7815) HDDS-12195. Implement skip() in OzoneFSInputStream (apache#7801) HDDS-12200. Fix grammar in OM HA, EC and Snapshot doc (apache#7806) HDDS-12202. OpsCreate and OpsAppend metrics not incremented (apache#7811) HDDS-12203. Initialize block length before skip (apache#7809) HDDS-12183. Reuse cluster across safe test classes (apache#7793) HDDS-11714. resetDeletedBlockRetryCount with --all may fail and can cause long db lock in large cluster. (apache#7665) HDDS-12186. (addendum) Avoid array allocation for table iterator (apache#7799) HDDS-12186. Avoid array allocation for table iterator. (apache#7797) HDDS-11508. Decouple delete batch limits from Ratis request size for DirectoryDeletingService. (apache#7365) HDDS-12073. Don't show Source Bucket and Volume if null in DU metadata (apache#7760) HDDS-12142. Save logs from build check (apache#7782) HDDS-12163. Reduce number of individual getCapacity/getAvailable/getUsedSpace calls (apache#7790) HDDS-12176. Trivial dependency cleanup.(apache#7787) HDDS-12181. Bump jline to 3.29.0 (apache#7789) HDDS-12165. Refactor VolumeInfoMetrics to use getCurrentUsage (apache#7784) HDDS-12085. Add manual refresh button for DU page (apache#7780) HDDS-12132. Parameterize testUpdateTransactionInfoTable for SCM (apache#7768) HDDS-11277. Remove dependency on hadoop-hdfs in Ozone client (apache#7781) ... Conflicts: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeConfiguration.java hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java hadoop-ozone/dist/src/main/smoketest/admincli/container.robot hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/ClosedContainerReplicator.java
…ee-improvements * HDDS-10239-container-reconciliation: (168 commits) HDDS-12112. Fix interval used for Chunk Read/Write Dashboard (apache#7724) HDDS-12212. Fix grammar in decommissioning and observability documentation (apache#7815) HDDS-12195. Implement skip() in OzoneFSInputStream (apache#7801) HDDS-12200. Fix grammar in OM HA, EC and Snapshot doc (apache#7806) HDDS-12202. OpsCreate and OpsAppend metrics not incremented (apache#7811) HDDS-12203. Initialize block length before skip (apache#7809) HDDS-12183. Reuse cluster across safe test classes (apache#7793) HDDS-11714. resetDeletedBlockRetryCount with --all may fail and can cause long db lock in large cluster. (apache#7665) HDDS-12186. (addendum) Avoid array allocation for table iterator (apache#7799) HDDS-12186. Avoid array allocation for table iterator. (apache#7797) HDDS-11508. Decouple delete batch limits from Ratis request size for DirectoryDeletingService. (apache#7365) HDDS-12073. Don't show Source Bucket and Volume if null in DU metadata (apache#7760) HDDS-12142. Save logs from build check (apache#7782) HDDS-12163. Reduce number of individual getCapacity/getAvailable/getUsedSpace calls (apache#7790) HDDS-12176. Trivial dependency cleanup.(apache#7787) HDDS-12181. Bump jline to 3.29.0 (apache#7789) HDDS-12165. Refactor VolumeInfoMetrics to use getCurrentUsage (apache#7784) HDDS-12085. Add manual refresh button for DU page (apache#7780) HDDS-12132. Parameterize testUpdateTransactionInfoTable for SCM (apache#7768) HDDS-11277. Remove dependency on hadoop-hdfs in Ozone client (apache#7781) ...
…DirectoryDeletingService. (apache#7365)
| } | ||
|
|
||
| return directories; | ||
| processedSubDirs = processedSubDirs || (!iterator.hasNext()); |
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.
@sadanand48 @sumitagrawl This is wrong if the last entry was skipped in line 2115 then iterator.hasNext() would return false. But the last entry was never deleted. Because of this directory would end up getting deleting without moving the last subFile/subDirectory entry from fileTable/DirectoryTable to deletedTable/deletedDirectoryTable
…st size for DirectoryDeletingService. (apache#7365) (cherry picked from commit 24aab04) Conflicts: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMConfigKeys.java hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestDirectoryDeletingServiceWithFSO.java hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/recon/TestReconInsightsForDeletedDirectories.java hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/DirectoryDeletingService.java hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestDirectoryDeletingService.java Change-Id: I2bed696e59fca178e4be69f428e6bb44ba31a2f8
…DirectoryDeletingService. (apache#7365) Backported from master commit 24aab04. Conflicts resolved: - AbstractKeyDeletingService.java: Kept HEAD import structure, excluded DeletingServiceMetrics - TestDirectoryDeletingService.java: Kept test from HDDS-11605 backport, simplified to work with buffer-based limits - Integration tests: Kept HEAD versions of cleanup methods - Table.java: Added missing Objects import - KeyManagerImpl.java: Removed getDeletedDirEntries method (not in interface) - SnapshotDeletingService.java: Updated to use new method signatures - TestSnapshotDeletingService.java: Removed OZONE_PATH_DELETING_LIMIT_PER_TASK config
What changes were proposed in this pull request?
Currently we limit the number of deletion objects (directories) in each run of DirectoryDeletingService based on Ratis request limit i.e If Ratis request proto size exceeds the limit , DDS stops sending further dirs for purging in the same run which means the task limit per run is not honoured. This PR fixes this by batching the requests as per Ratis proto limit and sending mutiple purge requests in the same run. This way the task limit per run is honoured.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11508
How was this patch tested?
Unit tests