Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-3913: Optimize the commit/optimize cycle in the PostTool (#2667)

Eric Pugh94146c1c3084
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) {