errose28 commented on code in PR #12139:
URL: https://github.com/apache/ozone/pull/12139#discussion_r4685145320
##########
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:
+1. Since this targeted as a minimal change I would like to avoid changing
the existing delete order of operations, which requires us to validate its
correctness again. We can re-evaluate if the witness DB can help us clean up
partial deletes with a follow-up design doc around broader witness DB usage.
I think this change was aimed to resolve [this
comment](https://github.com/apache/ozone/pull/12139#discussion_r4674048830),
but we should be able to just set `DELETED` in the witness DB in
`cleanupContainer` instead of changing 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]