lokeshj1703 opened a new pull request, #19120:
URL: https://github.com/apache/hudi/pull/19120

   ## What is the purpose of the pull request
   
   Fix two intermittently-failing tests in `hudi-java-client` caused by 
incorrect commit time ordering and unhandled OCC conflicts.
   
   ## Brief change log
   
   ### `TestJavaHoodieBackedMetadata.testReattemptOfFailedClusteringCommit`
   
   **Root cause**: The test inserts a write with hardcoded commit time 
`"0000003"` *after* scheduling clustering, which assigns a real wall-clock 
timestamp (e.g. `"20241201..."`). Since `"0000003" < "20241201..."` 
lexicographically, the new commit is **out-of-order** relative to the 
clustering commit. Hudi's metadata table (MDT) expects monotonically increasing 
commit times; inserting a logically-earlier commit after clustering can corrupt 
the MDT file listing state, causing `validateMetadata` to report mismatched 
listings for partitions like `2015/03/16`.
   
   **Fix**: Use `WriteClientTestUtils.createNewInstantTime()` instead of 
`"0000003"` to generate a proper monotonically increasing timestamp.
   
   ---
   
   ### `TestMultipleHoodieJavaWriteClient.testOccWithMultipleWriters`
   
   **Root cause**: 3 concurrent writers operate on 20 records with overlapping 
keys (0–9 repeated twice). Under OCC, `HoodieWriteConflictException` is a 
legitimate and expected outcome when writers concurrently target the same file 
groups. The exception was uncaught and propagated as a test failure. The test's 
stated intent (per its origin commit for HUDI-5583) is to verify **no deadlock 
occurs**, not that every single commit succeeds.
   
   **Fix**: Catch `HoodieWriteConflictException` around `writer.commit()` and 
log it as expected OCC behavior.
   
   ## Verifying this change
   
   - [ ] Existing tests in `hudi-java-client` pass
   - [ ] `testReattemptOfFailedClusteringCommit` and 
`testOccWithMultipleWriters` no longer fail intermittently


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

Reply via email to