sunchao opened a new pull request, #8513:
URL: https://github.com/apache/hadoop/pull/8513

   ## Why are the changes needed?
   
   With `fs.azure.write.enableappendwithflush=true`, ABFS's small-write 
optimized `hflush()` submits and consumes the active `DataBlock` but leaves it 
recorded as the active writable block. A later `close()` retries that already 
consumed block and fails with `IllegalStateException: Expected stream state 
Writing -but actual state is Closed`.
   
   JIRA: [HADOOP-19902](https://issues.apache.org/jira/browse/HADOOP-19902)
   
   ## What changes were proposed in this PR?
   
   Clear the active block after the optimized append-with-flush path submits it 
for upload, matching the lifecycle already used by `uploadCurrentBlock()`.
   
   Add a regression test with small-write optimization enabled that executes 
`write()`, `hflush()`, and `close()`, then asserts the payload is appended 
exactly once using `FLUSH_MODE`.
   
   Contains content generated by Codex.
   
   ## How was this PR tested?
   
   - Unit test: `./mvnw -pl hadoop-tools/hadoop-azure -am -DskipITs 
-Dtest=org.apache.hadoop.fs.azurebfs.services.TestAbfsOutputStream#verifySmallWriteOptimizedHFlushFollowedByClose
 -DfailIfNoTests=false test`
   
   ### AI Tooling
   
   - [x] The PR includes the phrase `Contains content generated by Codex`.
   - [x] My use of AI tooling follows ASF legal policy.
   


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