leventov commented on a change in pull request #7653: Refactor 
SQLMetadataSegmentManager; Change contract of REST methods in 
DataSourcesResource
URL: https://github.com/apache/incubator-druid/pull/7653#discussion_r287356104
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/metadata/SQLMetadataSegmentManager.java
 ##########
 @@ -171,24 +285,33 @@ public void start()
     }
   }
 
-  private Runnable createPollTaskForStartOrder(long startOrder)
+  private Runnable createPollTaskForStartOrder(long startOrder, 
PeriodicDatabasePoll periodicPollUpdate)
   {
     return () -> {
-      // poll() is synchronized together with start(), stop() and isStarted() 
to ensure that when stop() exits, poll()
-      // won't actually run anymore after that (it could only enter the 
syncrhonized section and exit immediately
-      // because the localStartedOrder doesn't match the new 
currentStartOrder). It's needed to avoid flakiness in
-      // SQLMetadataSegmentManagerTest. See 
https://github.com/apache/incubator-druid/issues/6028
-      ReentrantReadWriteLock.ReadLock lock = startStopLock.readLock();
+      // poll() is synchronized together with 
startPollingDatabasePeriodically(), stopPollingDatabasePeriodically() and
+      // isPollingDatabasePeriodically() to ensure that when 
stopPollingDatabasePeriodically() exits, poll() won't
+      // actually run anymore after that (it could only enter the synchronized 
section and exit immediately because the
+      // localStartedOrder doesn't match the new currentStartPollingOrder). 
It's needed to avoid flakiness in
+      // SqlSegmentsMetadataTest. See 
https://github.com/apache/incubator-druid/issues/6028
+      ReentrantReadWriteLock.ReadLock lock = startStopPollLock.readLock();
       lock.lock();
       try {
-        if (startOrder == currentStartOrder) {
+        if (startOrder == currentStartPollingOrder) {
           poll();
+          periodicPollUpdate.firstPollCompletionFuture.complete(null);
         } else {
-          log.debug("startOrder = currentStartOrder = %d, skipping poll()", 
startOrder);
+          log.debug("startOrder = currentStartPollingOrder = %d, skipping 
poll()", startOrder);
         }
       }
-      catch (Exception e) {
-        log.makeAlert(e, "uncaught exception in segment manager polling 
thread").emit();
+      catch (Throwable t) {
+        log.makeAlert(t, "Uncaught exception in " + getClass().getName() + "'s 
polling thread").emit();
 
 Review comment:
   Changed

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to