deepthi912 commented on code in PR #19596:
URL: https://github.com/apache/pinot/pull/19596#discussion_r4163216624


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -426,15 +434,15 @@ protected GenericRow doUpdateRecord(GenericRow record, 
RecordInfo recordInfo) {
           if (!recordInfo.isDeleteRecord()
               && 
recordInfo.getComparisonValue().compareTo(recordLocation.getComparisonValue()) 
>= 0) {
             IndexSegment currentSegment = recordLocation.getSegment();
-            ThreadSafeMutableRoaringBitmap currentQueryableDocIds = 
currentSegment.getQueryableDocIds();
             int currentDocId = recordLocation.getDocId();
-            if (currentQueryableDocIds == null || 
currentQueryableDocIds.contains(currentDocId)) {
+            // Read lock: currentSegment cannot be destroyed while LazyRow 
reads its columns. A consuming segment needs
+            // no lock: it is destroyed only after 
replaceSegment()/removeSegment() has moved or dropped every location
+            // pointing at it, and those run under the same per-key compute as 
this read.
+            if (tryAcquireSegmentReadLock(currentSegment)) {

Review Comment:
   CPU        Apple M2 Max — 12 cores (8 performance + 4 efficiency)
   Memory     32 GB
   OS         macOS 26.3.1
   JDK        Temurin OpenJDK 25.0.3+9 (LTS)
   Power      AC (not battery, so no power throttling)
   JVM flags  -Xms2G -Xmx8G
   
   
   ```
   ┌────────────────────────┬───────────────────┬───────────────────┐
   │                        │  Before  │  After   │
   ├────────────────────────┼───────────────────┼───────────────────┤
   │ merge — updateRecord() │ 6,082,667 ops/sec │ 5,922,819 ops/sec │
   ├────────────────────────┼───────────────────┼───────────────────┤
   │ per call               │          164.4 ns │          168.8 ns │
   ├────────────────────────┼───────────────────┼───────────────────┤
   │ added                  │                   │           +4.4 ns │
   ├────────────────────────┼───────────────────┼───────────────────┤
   ```



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