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

   ## Description
   
   `BaseTableDataManager.needReloadSegments()` inspects each segment via
   `ImmutableSegment.isReloadNeeded()` → `SegmentPreProcessor.needProcess()`, 
which reads the
   segment directory. It did so while holding only a reference count (from 
`acquireAllSegments()`),
   not the per-segment lock (`getSegmentLock`) that `reloadSegment` / 
`replaceSegment` /
   `offloadSegment` acquire. As a result, the reload-need check can run 
concurrently with a reload
   of the same segment that is mutating or releasing that segment's backing 
resources.
   
   This change inspects each segment under `getSegmentLock(segmentName)`, and 
re-acquires the
   segment fresh under the lock so a segment that a reload has already replaced 
is not inspected.
   Segment names are snapshotted first, so the lock is never taken while 
holding segment references
   (avoiding lock/refcount ordering surprises).
   
   ## Notes
   
   - Behavior is unchanged in the common case (no concurrent reload); the check 
simply no longer
     races with a reload / replace / offload of the same segment.
   - The per-segment lock is the same striped lock already used by the reload 
path, so the check now
     serializes with an in-progress reload of that segment.
   
   ## Testing
   
   - Existing table-data-manager tests pass.
   


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