Jackie-Jiang commented on code in PR #9132:
URL: https://github.com/apache/pinot/pull/9132#discussion_r933440966


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/PartitionUpsertMetadataManager.java:
##########
@@ -131,10 +144,22 @@ public void addSegment(ImmutableSegment segment) {
       return;
     }
 
-    Preconditions.checkArgument(segment instanceof ImmutableSegmentImpl,
-        "Got unsupported segment implementation: {} for segment: {}, table: 
{}", segment.getClass(), segmentName,
-        _tableNameWithType);
-    addSegment((ImmutableSegmentImpl) segment, new 
ThreadSafeMutableRoaringBitmap(), getRecordInfoIterator(segment));
+    Lock segmentLock = SegmentLocks.getSegmentLock(_tableNameWithType, 
segmentName);
+    segmentLock.lock();

Review Comment:
   Yes, the same lock can be acquired by the same thread twice (reentrant 
lock). Adding this lock can prevent add and remove happening at the same time



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