smengcl commented on code in PR #11384:
URL: https://github.com/apache/ozone/pull/11384#discussion_r4268052241


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java:
##########
@@ -438,7 +435,7 @@ public void executePutBlock(boolean close,
         if (e != null || reply == null || !reply.isSuccess()) {
           LOG.warn("Failed executePutBlockClose, reply=" + reply, e);
           try {
-            executePutBlock(true, false);
+            executePutBlock(batch, true, false);

Review Comment:
   Please keep the two-argument call here instead of replaying `batch`. Ratis 
3.3.1 closes the stream when CLOSE is submitted, so retrying this close against 
the same `out` immediately returns `AlreadyClosedException` and invokes this 
callback recursively. Each unwinding invocation also sends PutBlock and 
registers the same buffers at another commit index.
   
   With one 100-byte chunk and one close timeout, the head reproduced hundreds 
of PutBlocks, 44,000 acknowledged bytes, and `key.close()` failing with 
`IllegalArgumentException`. `handleException` uses the inflated acknowledgment 
count as the block position, then `commitKey` rejects its mismatch with the key 
offset. The base and this one-line change both acknowledge 100 bytes and commit 
the key once.
   
   ```diff
   --- 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java
   +++ 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockDataStreamOutput.java
   @@ -435,7 +435,7 @@
            if (e != null || reply == null || !reply.isSuccess()) {
              LOG.warn("Failed executePutBlockClose, reply=" + reply, e);
              try {
   -            executePutBlock(batch, true, false);
   +            executePutBlock(true, false);
              } catch (IOException ex) {
                throw new CompletionException(ex);
              }
   ```



-- 
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]

Reply via email to