This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 94146c1c308 SOLR-3913: Optimize the commit/optimize cycle in the
PostTool (#2667)
94146c1c308 is described below
commit 94146c1c3084d18038a95c51b0e90e605b187922
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...?
---
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 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());
}
@@ -461,7 +461,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) {
@@ -545,7 +545,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) {