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

   For upsert table, replacing segment could happen in two threads 
concurrently, but there are multiple steps to replace upsert segments and not 
thread safe. This PR changes to do them with segmentLock to be thread safe.
   
   For upsert table, when consuming thread commits a newly built immutable 
segment, it needs to replace the old mutable segment, in order to update the 
upsert states to point to the new immutable segment. But committing segment can 
take longer than expected. When committing takes long to complete, server 
decides to download the segment as a way to help catch up ingestion quicker. 
The HelixTaskExecutor thread, to download and replace segment, tries to stop 
the consuming thread by setting a _shouldStop flag, but once consuming thread 
doesn't check the flag while in the middle of replacing the segment. The The 
HelixTaskExecutor thread waits up to 10min and then continues to replace the 
segment. Now we would get two threads replacing the same upsert segment 
concurrently.
   
   In comparison, for non-upsert RT tables, it's thread safe to add or replace 
segments as the operation is made atomic; for OFFLINE tables, the segmentLock 
is taken to add or replace segment.


-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to