Gargi-jais11 commented on code in PR #10109:
URL: https://github.com/apache/ozone/pull/10109#discussion_r3231930084
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java:
##########
@@ -303,19 +303,31 @@ public DeleteBlockTransactionExecutionResult call() {
if (keyValueContainer.
writeLockTryLock(tryLockTimeoutMs, TimeUnit.MILLISECONDS)) {
try {
- String schemaVersion = containerData
- .getSupportedSchemaVersionOrDefault();
- if (getSchemaHandlers().containsKey(schemaVersion)) {
- schemaHandlers.get(schemaVersion).handle(containerData, tx);
+ // Re-fetch the container after acquiring the lock. DiskBalancer
may have relocated
+ // this container to a different disk while we waited — in that
case, the container
+ // object in ContainerSet has changed and containerData points
to the old replica.
+ Container<?> current = containerSet.getContainer(containerId);
+ if (current == null || current.getContainerData() !=
containerData) {
+ LOG.debug("DeleteBlocks: containerData for container {} is
stale "
+ + ", Will retry on the new replica.",
+ containerId);
+ lockAcquisitionFailed = true;
Review Comment:
Since the retry pass itself always goes through **writeLockTryLock**, a
stale-mapping failure surviving both the first attempt and the retry would
require DiskBalancer to move the same container a second time within the single
retry window — essentially impossible in practice. Adding a second boolean to
separate these cases introduces complexity without any real benefit. Keeping
the single lockAcquisitionFailed flag for both "try-lock timed out" and "stale
mapping after lock" is sufficient, and both correctly trigger the existing
single retry.
--
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]