Skip to content

Conversation

@sadanand48
Copy link
Contributor

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

@errose28
Copy link
Contributor

errose28 commented Oct 28, 2024

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.

@sadanand48
Copy link
Contributor Author

Are you planning to handle this for SCM block deletion and other OM services

Sure, will create sub tasks for these when the current one is fixed.

@errose28
Copy link
Contributor

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 sadanand48 marked this pull request as draft November 15, 2024 08:40
@sadanand48 sadanand48 marked this pull request as ready for review December 6, 2024 08:23
@sadanand48 sadanand48 requested review from sumitagrawl and removed request for sumitagrawl December 9, 2024 07:02
@adoroszlai
Copy link
Contributor

@sadanand48 HDDS-11605 introduced some conflicts, can you please update the PR?

Copy link
Contributor

@sumitagrawl sumitagrawl left a 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...

@sadanand48 sadanand48 marked this pull request as draft January 2, 2025 08:00
@sadanand48
Copy link
Contributor Author

remove the limit case and use only ratis size.

@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.

@sadanand48 sadanand48 marked this pull request as ready for review January 7, 2025 10:30
Copy link
Contributor

@sumitagrawl sumitagrawl left a 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.

Copy link
Contributor

@sumitagrawl sumitagrawl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@sadanand48 sadanand48 marked this pull request as draft January 24, 2025 05:49
@sadanand48 sadanand48 marked this pull request as ready for review February 3, 2025 04:21
Copy link
Contributor

@aryangupta1998 aryangupta1998 left a 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!

@aryangupta1998 aryangupta1998 merged commit 24aab04 into apache:master Feb 3, 2025
54 checks passed
Copy link
Contributor

@adoroszlai adoroszlai left a 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:

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:

/**
* @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:

long objectSerializedSize = entry.getRawValue().length;

long objectSerializedSize = entry.getRawValue().length;

We can get serialized size without allocating new arrays:

/** @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.

@sadanand48
Copy link
Contributor Author

Sure thanks @adoroszlai , will open a jira to handle this and raise a PR.

@adoroszlai
Copy link
Contributor

adoroszlai commented Feb 3, 2025

Thanks @sadanand48, I have created HDDS-12186, now assigned to you.

errose28 added a commit to errose28/ozone that referenced this pull request Feb 5, 2025
* 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
errose28 added a commit to errose28/ozone that referenced this pull request Feb 6, 2025
* 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
errose28 added a commit to errose28/ozone that referenced this pull request Feb 7, 2025
…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)
  ...
nandakumar131 pushed a commit to nandakumar131/ozone that referenced this pull request Feb 10, 2025
}

return directories;
processedSubDirs = processedSubDirs || (!iterator.hasNext());
Copy link
Contributor

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

swamirishi pushed a commit to swamirishi/ozone that referenced this pull request Dec 3, 2025
…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
Cyrill added a commit to Cyrill/ozone that referenced this pull request Dec 12, 2025
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants