dsmiley commented on a change in pull request #1446:
URL: https://github.com/apache/lucene-solr/pull/1446#discussion_r413106360



##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java
##########
@@ -843,6 +847,31 @@ public void downloadFromZK(String zkPath, Path dir) throws 
IOException {
     ZkMaintenanceUtils.downloadFromZK(this, zkPath, dir);
   }
 
+  /**
+   * Ensures we can subsequently read the most up-to-date state of the 
provided {@code path} and all data below
+   * it, after this method completes.
+   * This should not be called a lot; there may be some delay.  Consider 
alternative approaches It's often better to try to devise a way to
+   * "watch" for state changed instead of calling this.
+   */
+  public void sync(String path) {
+    // zookeeper.sync is asynchronous; we need to wait till it's done
+    CompletableFuture<Integer> future = new CompletableFuture<>();
+    keeper.sync(path, (rc, path1, ctx) -> future.complete(rc), null);
+    try {
+      Integer status = future.get(zkClientTimeout, TimeUnit.MILLISECONDS);

Review comment:
       I guess I could do that but it's only caller doesn't care.  It's a 
best-effort kind of thing.  I should add that to the javadocs; this method 
should not throw an exception.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to