This is an automated email from the ASF dual-hosted git repository.
sumitagrawal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new ece9330d8d HDDS-13448. DeleteBlocksCommandHandler thread stop for
normal exception (#8816)
ece9330d8d is described below
commit ece9330d8d0324abb1696e3441cb1eb562117d32
Author: Sumit Agrawal <[email protected]>
AuthorDate: Wed Jul 16 12:43:59 2025 +0530
HDDS-13448. DeleteBlocksCommandHandler thread stop for normal exception
(#8816)
---
.../commandhandler/DeleteBlocksCommandHandler.java | 4 +++-
.../TestDeleteBlocksCommandHandler.java | 25 ++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java
index dbc6b72968..419b27b565 100644
---
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java
+++
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/DeleteBlocksCommandHandler.java
@@ -480,8 +480,10 @@ public void handleTasksResults(
try {
DeleteBlockTransactionExecutionResult result = f.get();
handler.accept(result);
- } catch (InterruptedException | ExecutionException e) {
+ } catch (ExecutionException e) {
LOG.error("task failed.", e);
+ } catch (InterruptedException e) {
+ LOG.error("task interrupted.", e);
Thread.currentThread().interrupt();
}
});
diff --git
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java
index bc9c33197a..85d20f509a 100644
---
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java
+++
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestDeleteBlocksCommandHandler.java
@@ -40,13 +40,16 @@
import java.io.IOException;
import java.nio.file.Path;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.hdds.HddsConfigKeys;
@@ -271,6 +274,28 @@ public List<Future<DeleteBlockTransactionExecutionResult>>
answer(
blockDeleteMetrics.getTotalLockTimeoutTransactionCount());
}
+ @Test
+ public void testDeleteBlocksCommandHandlerExceptionShouldNotInterrupt()
throws Exception {
+ setup();
+ // future task will throw first execution exception, and next one will
succeed
+ doAnswer((Answer<List<Future<DeleteBlockTransactionExecutionResult>>>)
invocationOnMock -> {
+ List<Future<DeleteBlockTransactionExecutionResult>> result = new
ArrayList<>();
+ CompletableFuture<DeleteBlockTransactionExecutionResult> future =
+ new CompletableFuture<>();
+ future.completeExceptionally(new ExecutionException("Simulated
Exception", new IOException()));
+ result.add(future);
+ future = new CompletableFuture<>();
+ future.complete(new DeleteBlockTransactionExecutionResult(null, false));
+ result.add(future);
+ return result;
+ }).when(handler).submitTasks(any());
+
+ // last task as success should be returned as result, ignoring the first
failed task
+ List<DeleteBlockTransactionResult> deleteBlockTransactionResults =
+ handler.executeCmdWithRetry(Collections.emptyList());
+ assertEquals(1, deleteBlockTransactionResults.size());
+ }
+
@ContainerTestVersionInfo.ContainerTest
public void testDeleteCmdWorkerInterval(
ContainerTestVersionInfo versionInfo) throws Exception {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]