jtuglu-netflix commented on code in PR #18014:
URL: https://github.com/apache/druid/pull/18014#discussion_r2094950875


##########
server/src/main/java/org/apache/druid/segment/realtime/SegmentGenerationMetrics.java:
##########
@@ -297,7 +313,12 @@ public SegmentGenerationMetrics snapshot()
       messageGapSnapshot = System.currentTimeMillis() - maxTimestamp;
     }
     retVal.messageGap.set(messageGapSnapshot);
-    retVal.messageGapStats.set(messageGapStats.getAndSet(new 
MessageGapStats()));

Review Comment:
   > So, will we ever have the case (in the current semantics of 
TaskRealtimeMetricsMonitor) where a reader thread and writer thread try to 
access the same instance of MessageGapStats?
   
   Yes, 
[this](https://github.com/apache/druid/pull/17847#discussion_r2094612845) 
example that I gave before.
   
   Scenario:
   T1(appenderator): calls add(), does a get(), acquires reference to A
   T2 (snapshot): does getAndSet() from A to B, returning A.
   T1: updates A while snapshot thread is potentially reading A's members.
   



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