gortiz commented on code in PR #14386:
URL: https://github.com/apache/pinot/pull/14386#discussion_r1829483494


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -1004,12 +1006,26 @@ SegmentBuildDescriptor buildSegmentInternal(boolean 
forCommit) {
       _segmentLogger.warn("Table data manager is already shut down");
       return null;
     }
+    final long startTimeMillis = now();
     try {
-      final long startTimeMillis = now();
       if (_segBuildSemaphore != null) {
-        _segmentLogger.info("Waiting to acquire semaphore for building 
segment");
-        _segBuildSemaphore.acquire();
+        _segmentLogger.info("Trying to acquire semaphore for building 
segment");
+        Instant acquireStart = Instant.now();
+        int timeoutSeconds = 5;
+        while (!_segBuildSemaphore.tryAcquire(timeoutSeconds, 
TimeUnit.SECONDS)) {
+          _segmentLogger.warn("Could not acquire semaphore for building 
segment in {}",
+              Duration.between(acquireStart, Instant.now()));
+          timeoutSeconds = Math.min(timeoutSeconds * 2, 300);
+        }

Review Comment:
   What I want to do is to wait 5 seconds in the first attempt, then 10 
seconds, then 20, 40, 80, 160... and then 300. The reason to do not wait more 
than 300 seconds is that one log every 5 mins seem acceptable even if we have 
several partitions. There is no need to wait longer. Anyway I've just picked up 
random numbers.



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