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


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -1619,7 +1620,17 @@ public RealtimeSegmentDataManager(SegmentZKMetadata 
segmentZKMetadata, TableConf
 
     // Acquire semaphore to create stream consumers
     try {
-      _partitionGroupConsumerSemaphore.acquire();
+      while (!_partitionGroupConsumerSemaphore.tryAcquire(5, 
TimeUnit.MINUTES)) {

Review Comment:
   Since we are doing a timed acquire, let's also log a warning if it cannot 
get the lock, and also log the wait time so far



##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -1619,7 +1620,17 @@ public RealtimeSegmentDataManager(SegmentZKMetadata 
segmentZKMetadata, TableConf
 
     // Acquire semaphore to create stream consumers
     try {
-      _partitionGroupConsumerSemaphore.acquire();
+      while (!_partitionGroupConsumerSemaphore.tryAcquire(5, 
TimeUnit.MINUTES)) {
+        // reload segment metadata to get latest status
+        segmentZKMetadata = 
_realtimeTableDataManager.fetchZKMetadata(_segmentNameStr);
+
+        if (segmentZKMetadata.getStatus() == 
CommonConstants.Segment.Realtime.Status.DONE) {

Review Comment:
   We want to first check if `segmentZKMetadata != null`. In corner cases, 
latest consuming segment might be deleted, and it can be `null`



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