Caideyipi opened a new pull request, #18662:
URL: https://github.com/apache/iotdb/pull/18662

   ## Description
   
   ### Root cause
   
   `PageCacheDeletionBuffer.isAllDeletionFlushed()` inferred completion from 
queue emptiness and the serialization buffer position. After the persist worker 
dequeued a deletion but before it serialized that deletion, both checks could 
report empty. `close()` could then call `shutdownNow()`, interrupt the worker, 
and lose the deletion before it reached disk.
   
   ### Fix
   
   - Track every accepted deletion until its persist task completes, including 
the dequeued-but-not-yet-serialized window.
   - Coordinate registration and close atomically, and keep draining already 
accepted deletions after close begins.
   - Add a deterministic regression test that pauses serialization immediately 
after dequeue and verifies the deletion is not reported as flushed.
   
   ### Tests
   
   - `DeletionRecoverTest`: 2 tests passed
   - `PageCacheDeletionBufferTest`: 1 test passed
   - `DeletionResourceTest`: 6 tests passed
   - `mvn -pl iotdb-core/datanode validate`
   
   <hr>
   
   This PR has:
   - [x] been self-reviewed.
       - [x] concurrent write
   - [x] added comments explaining the why and the intent of the code wherever 
it would not be obvious for an unfamiliar reader.
   - [x] added unit tests to cover the new code path.
   
   <hr>
   
   ##### Key changed/added classes
   
   - `PageCacheDeletionBuffer`
   - `PageCacheDeletionBufferTest`


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