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



##########
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:
       Why synchronous method do you refer to?   If there was one that 
accomplishes this task here, I'd call it!  keeper.sync() is an asynchronous 
method.

##########
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:
       What synchronous method do you refer to?   If there was one that 
accomplishes this task here, I'd call it!  keeper.sync() is an asynchronous 
method.




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