This is an automated email from the ASF dual-hosted git repository.

jojochuang 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 03d838e01e0 HDDS-16398. Fix intermittent AlreadyClosedException in 
TestCommitWatcher (#11227)
03d838e01e0 is described below

commit 03d838e01e0a2c33c5e9ec1d9d3b9e24aad2923f
Author: Andrey Yarovoy <[email protected]>
AuthorDate: Tue Sep 29 02:58:49 2026 -0400

    HDDS-16398. Fix intermittent AlreadyClosedException in TestCommitWatcher 
(#11227)
    
    Generated-by: Claude Code (Claude Opus 5)
---
 .../hadoop/hdds/scm/storage/TestCommitWatcher.java    | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/storage/TestCommitWatcher.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/storage/TestCommitWatcher.java
index 843b738e6e9..656a3940edf 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/storage/TestCommitWatcher.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/storage/TestCommitWatcher.java
@@ -104,12 +104,6 @@ public void init() throws Exception {
     raftClientConfig.setRpcWatchRequestTimeout(Duration.ofSeconds(3));
     conf.setFromObject(raftClientConfig);
 
-    RatisClientConfig ratisClientConfig =
-        conf.getObject(RatisClientConfig.class);
-    ratisClientConfig.setWriteRequestTimeout(Duration.ofSeconds(10));
-    ratisClientConfig.setWatchRequestTimeout(Duration.ofSeconds(10));
-    conf.setFromObject(ratisClientConfig);
-
     OzoneClientConfig clientConfig = conf.getObject(OzoneClientConfig.class);
     clientConfig.setChecksumType(ChecksumType.NONE);
     conf.setFromObject(clientConfig);
@@ -158,12 +152,14 @@ public void testReleaseBuffers() throws Exception {
         assertEquals(1, xceiverClient.getRefcount());
         XceiverClientRatis ratisClient = 
assertInstanceOf(XceiverClientRatis.class, xceiverClient);
         CommitWatcher watcher = new CommitWatcher(bufferPool, ratisClient);
-        BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
         List<XceiverClientReply> replies = new ArrayList<>();
         long length = 0;
         List<CompletableFuture<ContainerCommandResponseProto>>
             futures = new ArrayList<>();
         for (int i = 0; i < capacity; i++) {
+          // Use a distinct block per iteration; a real client never rewrites 
the
+          // same blockID and offset with different data.
+          BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
           ContainerCommandRequestProto writeChunkRequest =
               ContainerTestHelper
                   .getWriteChunkRequest(pipeline, blockID, CHUNK_SIZE);
@@ -224,12 +220,14 @@ public void testReleaseBuffersOnException() throws 
Exception {
         assertEquals(1, xceiverClient.getRefcount());
         XceiverClientRatis ratisClient = 
assertInstanceOf(XceiverClientRatis.class, xceiverClient);
         CommitWatcher watcher = new CommitWatcher(bufferPool, ratisClient);
-        BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
         List<XceiverClientReply> replies = new ArrayList<>();
         long length = 0;
         List<CompletableFuture<ContainerCommandResponseProto>>
             futures = new ArrayList<>();
         for (int i = 0; i < capacity; i++) {
+          // Use a distinct block per iteration; a real client never rewrites 
the
+          // same blockID and offset with different data.
+          BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
           ContainerCommandRequestProto writeChunkRequest =
               ContainerTestHelper
                   .getWriteChunkRequest(pipeline, blockID, CHUNK_SIZE);
@@ -274,9 +272,8 @@ public void testReleaseBuffersOnException() throws 
Exception {
         IOException ioe =
             assertThrows(IOException.class, () -> 
watcher.watchForCommit(replies.get(1).getLogIndex() + 100));
         Throwable t = HddsClientUtils.checkForException(ioe);
-        // with retry count set to noRetry and a lower watch request
-        // timeout, watch request will eventually
-        // fail with TimeoutIOException from ratis client or the client
+        // Two of the three datanodes are down, so the watch can never be 
satisfied. It fails once the
+        // client watch timeout expires, with TimeoutIOException from the 
ratis client, or the client
         // can itself get AlreadyClosedException from the Ratis Server
         // and the write may fail with RaftRetryFailureException
         assertTrue(


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to