wattt3 opened a new pull request, #3427:
URL: https://github.com/apache/fluss/pull/3427

   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #3386
   
   <!-- What is the purpose of the change -->
   `FlussAdminITCase.testGetTableStatsForPrimaryKeyTableWithFailover` is a 
flaky test(`expected: 170 but was: 160`).
   
   The root cause is `flushedLogOffset = exclusiveUpToLogOffset` in 
`KvTablet#flush`, which does not keep `flushedLogOffset` monotonically 
increasing.
   
   When `flush` is called with an `exclusiveUpToLogOffset` lower than the 
current `flushedLogOffset`, `flushedLogOffset` is rolled back to that lower 
value, while `rowCount` is not. As a result, the `(flushedLogOffset, rowCount)` 
pair becomes inconsistent.
   
   During failover, a kv snapshot can capture this inconsistent pair, and 
recovery then replays the log from the stale offset and double-counts the 
already-applied deletes, under-reporting the row count
   
   ### Brief change log
   
   - `KvTablet#flush` now only advanced `flushedLogOffset` when 
`exclusiveUpToLogOffset` is greater than current value.
   
   <!-- Please describe the changes made in this pull request and explain how 
they address the issue -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


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