From 94146c1c3084d18038a95c51b0e90e605b187922 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Tue, 27 Aug 2024 06:25:45 -0400 Subject: [PATCH] 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...? --- 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 3b428a105b5..1883da984d6 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -129,6 +129,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 9c81486906f..e46b2a38d99 100644 --- a/solr/core/src/java/org/apache/solr/cli/PostTool.java +++ b/solr/core/src/java/org/apache/solr/cli/PostTool.java @@ -335,11 +335,11 @@ public void execute(String mode) throws SolrServerException, IOException { return; } - if (commit) { - commit(); - } if (optimize) { + // optimize does a commit under the covers. optimize(); + } else if (commit) { + commit(); } displayTiming((long) timer.getTime()); } @@ -461,7 +461,7 @@ boolean recursionPossible(String[] args) { * @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) { @@ -545,7 +545,7 @@ int postFiles(File[] files, OutputStream out, String type) { * * @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) {