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

   ### Describe the issue this Pull Request addresses
   
   The test below is flaky and is failing from time to time:
   
   ```log
   
TestPartitionStatsIndex.testPartitionStatsWithRestore:490->$anonfun$testPartitionStatsWithRestore$2$adapted:490->$anonfun$testPartitionStatsWithRestore$2:491
 expected: <false> but was: <true>
   ```
   
   This PR aims to address this by adding proper lifecycle management to the 
`*Clients` used.
   
   ### Summary and Changelog
   
   -  Change 1: Stale MetaClient
     - Added `metaClient = HoodieTableMetaClient.reload(metaClient)` after the 
new upsert
     - Ensures the `metaClient` picks up the latest metadata state before 
loading column stats
     -  Without this, column stats would have stale entries
   - Change 2: Proper Client Lifecycle Management
     - Kept the original `writeClient.close()`, this is intentional to stop any 
ongoing indexing operations after savepoint (CMIIW)
     - Create a new restoreClient specifically for the restore operation, then 
closed it immediately after use
     - This avoids the bug of reusing a closed client, while respecting the 
original intent to stopping indexing early (CMIIW)
   
   ### Impact
   
   CI is less likely to fail due to flaky `testPartitionStatsWithRestore`
   
   ### Risk Level
   
   None
   
   ### Documentation Update
   
   None
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Enough context is provided in the sections above
   - [ ] Adequate tests were added if applicable
   


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