This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new c316c7fab24 SOLR-3913: Optimize the commit/optimize cycle in the 
PostTool (#2667)
c316c7fab24 is described below

commit c316c7fab249d45443dbd1c1ee0c6a850c999dc9
Author: Eric Pugh <[email protected]>
AuthorDate: Tue Aug 27 06:25:45 2024 -0400

    SOLR-3913: Optimize the commit/optimize cycle in the PostTool (#2667)
    
    Arguably you shouldn't be able to pass in the skip-commit AND the optimize 
options as the same time...?
    
    (cherry picked from commit 94146c1c3084d18038a95c51b0e90e605b187922)
---
 solr/CHANGES.txt                                     |  2 ++
 solr/core/src/java/org/apache/solr/cli/PostTool.java | 10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 39b35e84ee9..7678f15abf9 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -31,6 +31,8 @@ Optimizations
 * SOLR-17408: COLSTATUS command was fetching details remotely from replicas 
when this information
   wasn't asked for. (Mathieu Marie)
 
+* SOLR-3913: Optimize PostTool to call just optimize when both commit and 
optimize requested. (Eric Pugh)
+
 Bug Fixes
 ---------------------
 (No changes)
diff --git a/solr/core/src/java/org/apache/solr/cli/PostTool.java 
b/solr/core/src/java/org/apache/solr/cli/PostTool.java
index e44d03481c8..3077c8979db 100644
--- a/solr/core/src/java/org/apache/solr/cli/PostTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/PostTool.java
@@ -332,11 +332,11 @@ public class PostTool extends ToolBase {
       return;
     }
 
-    if (commit) {
-      commit();
-    }
     if (optimize) {
+      // optimize does a commit under the covers.
       optimize();
+    } else if (commit) {
+      commit();
     }
     displayTiming((long) timer.getTime());
   }
@@ -458,7 +458,7 @@ public class PostTool extends ToolBase {
    * @param args array of file names
    * @param startIndexInArgs offset to start
    * @param out output stream to post data to
-   * @param type default content-type to use when posting (may be overridden 
in auto mode)
+   * @param type default content-type to use when posting (this may be 
overridden in auto mode)
    * @return number of files posted
    */
   public int postFiles(String[] args, int startIndexInArgs, OutputStream out, 
String type) {
@@ -542,7 +542,7 @@ public class PostTool extends ToolBase {
    *
    * @param globFile file holding glob path
    * @param out outputStream to write results to
-   * @param type default content-type to use when posting (may be overridden 
in auto mode)
+   * @param type default content-type to use when posting (this may be 
overridden in auto mode)
    * @return number of files posted
    */
   int handleGlob(File globFile, OutputStream out, String type) {

Reply via email to