ptlrs commented on code in PR #12139:
URL: https://github.com/apache/ozone/pull/12139#discussion_r4691800885
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -2539,21 +2542,24 @@ private void deleteInternal(Container container,
boolean force)
HddsVolume hddsVolume = keyValueContainerData.getVolume();
// Steps to delete
- // 1. container marked deleted
- // 2. container is removed from container set
+ // 1. witnessed container DB entry set to DELETED, container is
removed from container set
+ // 2. container marked deleted
// 3. container db handler and content removed from db
// 4. container moved to tmp folder
// 5. container content deleted from tmp folder
+ long waitTime = clock.millis() - startTime;
+ if (waitTime > maxDeleteLockWaitMs) {
+ LOG.warn("An attempt to delete container {} took {} ms acquiring
locks and pre-checks. " +
+ "The delete has been skipped and should be retried
automatically by SCM.",
+ containerLocked.getContainerData().getContainerID(), waitTime);
+ return;
+ }
+ // Step 1 is first and outside the try below. If the entry cannot be
written, nothing has changed yet: the
+ // delete fails with the witnessed container DB error and the replica
stays as it was. If the datanode stops
+ // after step 1, the replica on disk is intact and is loaded again at
startup.
+ containerSet.removeContainer(containerId);
Review Comment:
I have reverted the order of operations
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]