Skip to content
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

HDDS-9107. Reduce the granularity of Container locks for BlockDeletingService #5149

Merged
merged 2 commits into from
Sep 13, 2023

Conversation

xichen01
Copy link
Contributor

@xichen01 xichen01 commented Aug 4, 2023

What changes were proposed in this pull request?

Reduce the granularity of Container locks for BlockDeletingService, Reduces the amount of time the BlockDeletingService holds a Container lock to reduce affect to others threads who need acquire the Container lock

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-9107

How was this patch tested?

existing test

LOG.info("Max lock hold time ({} ms) reached after {} ms. " +
"Completed {} transactions, deleted {} blocks." +
"Releasing lock and resuming deletion later.",
getBlockDeletingMaxLockHoldingTime().toMillis(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Log the container information as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

ContainerBackgroundTaskResult crr = handleDeleteTask();
blocksToDelete -= crr.getSize();
result.addAll(crr.getDeletedBlocks());
if (blocksToDelete > 0 && crr.getSize() == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this check ahead, follow the handleDeleteTask call.

@@ -167,6 +192,7 @@ public ContainerBackgroundTaskResult deleteViaSchema1(
if (toDeleteBlocks.isEmpty()) {
LOG.debug("No under deletion block found in container : {}",
containerData.getContainerID());
blocksToDelete = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

The reset is not necessary, can be removed.

@@ -321,6 +347,7 @@ private ContainerBackgroundTaskResult deleteViaTransactionStore(
// actually no delete transactions for the container, so reset the
// pending delete block count to the correct value of zero.
containerData.resetPendingDeleteBlockCount(meta);
blocksToDelete = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

@@ -335,12 +362,18 @@ private ContainerBackgroundTaskResult deleteViaTransactionStore(
int deletedBlocksProcessed = deleteBlocksResult.getBlocksProcessed();
int deletedBlocksCount = deleteBlocksResult.getBlocksDeleted();
long releasedBytes = deleteBlocksResult.getBytesReleased();
List<DeletedBlocksTransaction> deletedBlocksTxs =
deleteBlocksResult.getDeletedBlockTransactions();
deleteBlocksResult.getDeletedBlockTransactions().forEach(
Copy link
Contributor

Choose a reason for hiding this comment

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

deleteBlocksResult.getDeletedBlockTransactions() -> deletedBlocksTxs

@ChenSammi
Copy link
Contributor

@xichen01 , can you add a unit test in TestBlockDeletingService.java for this if possible?

@xichen01
Copy link
Contributor Author

@xichen01 , can you add a unit test in TestBlockDeletingService.java for this if possible?

I have added a unit test in TestBlockDeletingService.java

Copy link
Contributor

@ChenSammi ChenSammi left a comment

Choose a reason for hiding this comment

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

Thanks @xichen01 .

@ChenSammi ChenSammi merged commit 5eea5ec into apache:master Sep 13, 2023
31 checks passed
errose28 added a commit to errose28/ozone that referenced this pull request Sep 14, 2023
* master: (55 commits)
  HDDS-9236. Fix snapdiff output for key modification (apache#5258)
  HDDS-8013. Freon S3 bucket creation test should use unique prefix (apache#5282)
  HDDS-9228. Poor S3G read performance (apache#5274)
  HDDS-8941. Disable flaky TestContainerBalancerTask#testDelayedStart
  HDDS-1159. Remove flaky tag from TestContainerStateManagerIntegration (apache#5291)
  HDDS-6077. Remove flaky tag from TestAddRemoveOzoneManager (apache#5290)
  HDDS-6610. Remove support for recursive volume list/delete using ozone fs command (apache#5264)
  HDDS-7752. GetS3SecretRequest API should not return secret if secret of user already exists (apache#4538)
  HDDS-9173. Invalidate snapshot cache once snapshot gets purged (apache#5248)
  HDDS-8920. Ozone is supporting unicode volume and bucket names, unintentionally (apache#5276)
  HDDS-9275. LegacyReplicationManager: Delete excess unhealthy with force=true (apache#5286)
  HDDS-9264. Execute EC acceptance test in secure environment (apache#5279)
  HDDS-9161. Recon Pipelines datanode columns search does not work (apache#5213)
  HDDS-9107. Reduce the granularity of Container locks for BlockDeletingService (apache#5149)
  HDDS-9270. Create a script to list all acceptance test splits (apache#5281)
  HDDS-9220. Let ContainerBalancerConfiguration#toString print more info (apache#5228)
  HDDS-9208. Add queue limit in ReplicationServer. (apache#5216)
  HDDS-9268. [Snapshot] Update list of snapshot apis to include lsDiff details in docs. (apache#5278)
  HDDS-9234. OM should shutdown immediately if certificate durations are invalid (apache#5243)
  HDDS-9136. Throw exception when rename fails during moveToTrash. (apache#5253)
  ...
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.

3 participants