epugh commented on code in PR #4728:
URL: https://github.com/apache/solr/pull/4728#discussion_r3770296623


##########
solr/core/src/java/org/apache/solr/handler/SnapShooter.java:
##########
@@ -228,7 +234,42 @@ public static IndexCommit 
getAndSaveNamedIndexCommit(SolrCore solrCore, String c
             + solrCore.getName());
   }
 
+  /**
+   * The status of a snapshot that has been requested but has not finished 
yet. A null {@link
+   * #snapshotName} is omitted rather than reported, matching how {@link 
CoreSnapshotResponse}
+   * reports the same snapshot once it has completed.
+   */
+  private NamedList<Object> inProgressDetails(String startTime, String status) 
{
+    NamedList<Object> details = new SimpleOrderedMap<>();
+    details.add("startTime", startTime);
+    details.add("status", status);
+    if (snapshotName != null) {
+      details.add("snapshotName", snapshotName);
+    }
+    details.add("directoryName", directoryName);
+    return details;
+  }
+
+  /**
+   * The status of a snapshot whose files are being copied. Only reported once 
the index commit has
+   * been resolved, since until then there is no file list to count.
+   *
+   * @param fileCount the total number of files this snapshot will copy
+   * @param finishedFileCount how many of them have been copied so far
+   */
+  private NamedList<Object> runningDetails(String startTime, int fileCount, 
int finishedFileCount) {
+    NamedList<Object> details = inProgressDetails(startTime, RUNNING_STATUS);
+    details.add("fileCount", fileCount);
+    details.add("finishedFileCount", finishedFileCount);
+    return details;
+  }
+
   public void createSnapAsync(final int numberToKeep, Consumer<NamedList<?>> 
result) {
+    this.progressListener = result;
+    // Report before the thread starts, otherwise the previously reported 
status (possibly a
+    // "success" from an earlier snapshot) stays visible until the index 
commit has been resolved.

Review Comment:
   so is the idea that a success is just going to hangaround for forever, or 
until the next snapshot is begun?  I guess that is how it works...   



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