maytasm commented on a change in pull request #9965:
URL: https://github.com/apache/druid/pull/9965#discussion_r437818519



##########
File path: 
server/src/main/java/org/apache/druid/metadata/SqlSegmentsMetadataManager.java
##########
@@ -403,11 +425,16 @@ private void awaitOrPerformDatabasePoll()
   }
 
   /**
-   * If the latest {@link DatabasePoll} is a {@link PeriodicDatabasePoll}, or 
an {@link OnDemandDatabasePoll} that is
-   * made not longer than {@link #periodicPollDelay} from now, awaits for it 
and returns true; returns false otherwise,
-   * meaning that a new on-demand database poll should be initiated.
+   * This method returns true without waiting for database poll if the latest 
{@link DatabasePoll} is a
+   * {@link PeriodicDatabasePoll} that has completed it's first poll, or an 
{@link OnDemandDatabasePoll} that is
+   * made not longer than {@link #periodicPollDelay} from current time.
+   * This method does wait untill completion for if the latest {@link 
DatabasePoll} is a
+   * {@link PeriodicDatabasePoll} that has not completed it's first poll, or 
an {@link OnDemandDatabasePoll} that is
+   * alrady in the process of polling the database.
+   * This means that any method using this check can read from snapshot that is
+   * up to {@link SqlSegmentsMetadataManager#periodicPollDelay} old.
    */
-  private boolean awaitLatestDatabasePoll()
+  private boolean useLatestSnapshotIfWithinDelay()

Review comment:
       I really dont like the old name. This method most of the time does not 
wait (even though the method is called await). For example, if the latest poll 
is PeriodicDatabasePoll, it will never wait and just return the last poll. Even 
if there is a on-going PeriodicDatabasePoll, it does not wait and return the 
last poll. If the latest poll is OnDemandDatabasePoll, it will only wait if the 
latest is older than pollPeriod. This means that most of the time this method 
does not await and return last poll.  




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



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

Reply via email to