tarun11Mavani opened a new pull request, #20283:
URL: https://github.com/apache/pinot/pull/20283

   Follow-up to #19776, addressing the first of the two remaining cases in
   https://github.com/apache/pinot/pull/19776#issuecomment-6932937652
   
   ## Problem
   `Deleted_Segments_Metadata` (and the existing `Deleted_Segments`) is a valid 
raw table name, so an
   archive root can also be a live table's own deep-store directory. The sweep 
in
   `SegmentDeletionManager` runs unconditionally, even with 
`controller.deleted.segments.preserveMetadata`
   off. On object stores, listing a segment file key as a directory returns 
empty, and the empty-directory
   cleanup then calls `delete(<segment>, false)`, which removes the live 
segment object. This affects
   OFFLINE and REALTIME tables and does not wait for segment retention.
   
   ## Fix
   - Skip the sweep of a root, with a warning, when a live OFFLINE or REALTIME 
table has that raw name.
     The check reads the table config ZNRecord; if ZooKeeper cannot be read, it 
assumes a collision.
   - Skip non-directory entries under a root before the empty-directory cleanup.
   - With preservation on, delete instead of archive the sidecars when a live 
table is named
     `Deleted_Segments_Metadata`, so nothing is written into that table's live 
directory.
   
   ## Tests
   `SegmentDeletionManagerTest` gains 3 tests (5 cases), run with a fake 
`PinotFS` that mimics object-store
   listing (`LocalPinotFS` throws instead of returning empty, so a local-FS 
test would pass without the fix):
   - a live table named after each root keeps its segment files through the 
sweep
   - a stray file directly under each root is not deleted
   - preservation does not archive a sidecar into a live table named 
`Deleted_Segments_Metadata`
   
   All 5 cases fail before the fix and pass after; the 28 tests in the class 
pass. Unit tests only, nothing
   run against a real object store or cluster.
   
   ## Not covered
   - A live table named `Deleted_Segments` still receives archived segments in 
its live directory
     (`moveSegmentsToDeletedDir`); only the sweep and the metadata archive 
write are guarded here.
   - While a collision persists, files legitimately archived under the 
colliding root are not aged out.
   


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