Skip to content

Commit 8d7edeb

Browse files
epughmalliaridis
andauthored
SOLR-17470: CLI resolve -s (#2743)
The -s parameter now only means "provide a solr url" through out all of our most widely used Solr CLI scripts. --------- Co-authored-by: Christos Malliaridis <[email protected]>
1 parent 47c4aae commit 8d7edeb

35 files changed

+154
-59
lines changed

dev-tools/scripts/cloud.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ start(){
334334
echo "Final NUM_NODES is $NUM_NODES"
335335
for i in `seq 1 $NUM_NODES`; do
336336
mkdir -p "${CLUSTER_WD}/n${i}"
337-
argsArray=(-c -s $CLUSTER_WD_FULL/n${i} -z localhost:${ZK_PORT}/solr_${SAFE_DEST} -p 898${i} -m $MEMORY \
337+
argsArray=(-c --solr-home $CLUSTER_WD_FULL/n${i} -z localhost:${ZK_PORT}/solr_${SAFE_DEST} -p 898${i} -m $MEMORY \
338338
-a "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=500${i} \
339339
-Dsolr.log.dir=$CLUSTER_WD_FULL/n${i} $JVM_ARGS")
340340
FINAL_COMMAND="${SOLR}/bin/solr ${argsArray[@]}"

solr/bin/solr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ function print_usage() {
367367

368368
if [[ "$CMD" == "start" || "$CMD" == "restart" ]]; then
369369
echo ""
370-
echo "Usage: solr $CMD [-f] [-c] [--host host] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [--jvm-opts \"jvm-opts\"] [-V]"
370+
echo "Usage: solr $CMD [-f] [-c] [--host host] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [--solr-home solr.solr.home] [-t solr.data.home] [--jvm-opts \"jvm-opts\"] [-V]"
371371
echo ""
372372
echo " -f Start Solr in foreground; default starts Solr in the background"
373373
echo " and sends stdout / stderr to solr-PORT-console.log"
@@ -393,7 +393,7 @@ function print_usage() {
393393
echo " -m/--memory <memory> Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g"
394394
echo " results in: -Xms4g -Xmx4g; by default, this script sets the heap size to 512m"
395395
echo ""
396-
echo " -s <dir> Sets the solr.solr.home system property; Solr will create core directories under"
396+
echo " --solr-home <dir> Sets the solr.solr.home system property; Solr will create core directories under"
397397
echo " this directory. This allows you to run multiple Solr instances on the same host"
398398
echo " while reusing the same server directory set using the -d parameter. If set, the"
399399
echo " specified directory should contain a solr.xml file, unless solr.xml exists in Zookeeper."

solr/bin/solr.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ goto done
307307

308308
:start_usage
309309
@echo.
310-
@echo Usage: solr %SCRIPT_CMD% [-f] [-c] [--host hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [-s solr.solr.home] [-t solr.data.home] [--jvm-opts "jvm-opts"] [-V]
310+
@echo Usage: solr %SCRIPT_CMD% [-f] [-c] [--host hostname] [-p port] [-d directory] [-z zkHost] [-m memory] [-e example] [--solr-home solr.solr.home] [-t solr.data.home] [--jvm-opts "jvm-opts"] [-V]
311311
@echo.
312312
@echo -f Start Solr in foreground; default starts Solr in the background
313313
@echo and sends stdout / stderr to solr-PORT-console.log
@@ -333,7 +333,7 @@ goto done
333333
@echo -m memory Sets the min (-Xms) and max (-Xmx) heap size for the JVM, such as: -m 4g
334334
@echo results in: -Xms4g -Xmx4g; by default, this script sets the heap size to 512m
335335
@echo.
336-
@echo -s dir Sets the solr.solr.home system property; Solr will create core directories under
336+
@echo --solr.home dir Sets the solr.solr.home system property; Solr will create core directories under
337337
@echo this directory. This allows you to run multiple Solr instances on the same host
338338
@echo while reusing the same server directory set using the -d parameter. If set, the
339339
@echo specified directory should contain a solr.xml file, unless solr.xml exists in Zookeeper.

solr/core/src/java/org/apache/solr/cli/AssertTool.java

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.List;
2727
import java.util.concurrent.TimeUnit;
2828
import org.apache.commons.cli.CommandLine;
29+
import org.apache.commons.cli.DeprecatedAttributes;
2930
import org.apache.commons.cli.Option;
3031
import org.apache.solr.client.solrj.SolrClient;
3132
import org.apache.solr.client.solrj.SolrServerException;
@@ -65,18 +66,40 @@ public List<Option> getOptions() {
6566
.longOpt("not-root")
6667
.build(),
6768
Option.builder("r").desc("Asserts that we are the root user.").longOpt("root").build(),
68-
Option.builder("S")
69+
Option.builder()
6970
.desc("Asserts that Solr is NOT running on a certain URL. Default timeout is 1000ms.")
7071
.longOpt("not-started")
7172
.hasArg(true)
7273
.argName("url")
7374
.build(),
74-
Option.builder("s")
75+
Option.builder("S")
76+
.desc("Asserts that Solr is NOT running on a certain URL. Default timeout is 1000ms.")
77+
.deprecated(
78+
DeprecatedAttributes.builder()
79+
.setForRemoval(true)
80+
.setSince("9.8")
81+
.setDescription("Use --not-started instead")
82+
.get())
83+
.hasArg(true)
84+
.argName("url")
85+
.build(),
86+
Option.builder()
7587
.desc("Asserts that Solr is running on a certain URL. Default timeout is 1000ms.")
7688
.longOpt("started")
7789
.hasArg(true)
7890
.argName("url")
7991
.build(),
92+
Option.builder("s")
93+
.desc("Asserts that Solr is running on a certain URL. Default timeout is 1000ms.")
94+
.deprecated(
95+
DeprecatedAttributes.builder()
96+
.setForRemoval(true)
97+
.setSince("9.8")
98+
.setDescription("Use --started instead")
99+
.get())
100+
.hasArg(true)
101+
.argName("url")
102+
.build(),
80103
Option.builder()
81104
.desc("Asserts that we run as same user that owns <directory>.")
82105
.longOpt("same-user")
@@ -201,15 +224,17 @@ protected int runAssert(CommandLine cli) throws Exception {
201224
if (cli.hasOption("same-user")) {
202225
ret += sameUser(cli.getOptionValue("same-user"));
203226
}
204-
if (cli.hasOption("s")) {
227+
if (cli.hasOption("s") || cli.hasOption("started")) {
205228
ret +=
206229
assertSolrRunning(
207-
cli.getOptionValue("s"), cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()));
230+
SolrCLI.getOptionWithDeprecatedAndDefault(cli, "started", "s", null),
231+
cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()));
208232
}
209-
if (cli.hasOption("S")) {
233+
if (cli.hasOption("S") || cli.hasOption("not-started")) {
210234
ret +=
211235
assertSolrNotRunning(
212-
cli.getOptionValue("S"), cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()));
236+
SolrCLI.getOptionWithDeprecatedAndDefault(cli, "not-started", "S", null),
237+
cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()));
213238
}
214239
if (cli.hasOption("c")) {
215240
ret +=

solr/core/src/java/org/apache/solr/cli/AuthTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public List<Option> getOptions() {
193193
.build(),
194194
SolrCLI.OPTION_SOLRURL,
195195
SolrCLI.OPTION_SOLRURL_DEPRECATED,
196+
SolrCLI.OPTION_SOLRURL_DEPRECATED_SHORT,
196197
SolrCLI.OPTION_ZKHOST,
197198
SolrCLI.OPTION_ZKHOST_DEPRECATED,
198199
SolrCLI.OPTION_CREDENTIALS);

solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public List<Option> getOptions() {
8686
.build(),
8787
SolrCLI.OPTION_SOLRURL,
8888
SolrCLI.OPTION_SOLRURL_DEPRECATED,
89+
SolrCLI.OPTION_SOLRURL_DEPRECATED_SHORT,
8990
SolrCLI.OPTION_ZKHOST,
9091
SolrCLI.OPTION_ZKHOST_DEPRECATED,
9192
SolrCLI.OPTION_CREDENTIALS);

solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public List<Option> getOptions() {
8888
.build(),
8989
SolrCLI.OPTION_SOLRURL,
9090
SolrCLI.OPTION_SOLRURL_DEPRECATED,
91+
SolrCLI.OPTION_SOLRURL_DEPRECATED_SHORT,
9192
SolrCLI.OPTION_ZKHOST,
9293
SolrCLI.OPTION_ZKHOST_DEPRECATED,
9394
SolrCLI.OPTION_CREDENTIALS);

solr/core/src/java/org/apache/solr/cli/ConfigTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public List<Option> getOptions() {
112112
.build(),
113113
SolrCLI.OPTION_SOLRURL,
114114
SolrCLI.OPTION_SOLRURL_DEPRECATED,
115+
SolrCLI.OPTION_SOLRURL_DEPRECATED_SHORT,
115116
SolrCLI.OPTION_ZKHOST,
116117
SolrCLI.OPTION_ZKHOST_DEPRECATED,
117118
SolrCLI.OPTION_CREDENTIALS);

solr/core/src/java/org/apache/solr/cli/CreateTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public List<Option> getOptions() {
158158
.build(),
159159
SolrCLI.OPTION_SOLRURL,
160160
SolrCLI.OPTION_SOLRURL_DEPRECATED,
161+
SolrCLI.OPTION_SOLRURL_DEPRECATED_SHORT,
161162
SolrCLI.OPTION_ZKHOST,
162163
SolrCLI.OPTION_ZKHOST_DEPRECATED,
163164
SolrCLI.OPTION_CREDENTIALS);

solr/core/src/java/org/apache/solr/cli/DeleteTool.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public List<Option> getOptions() {
134134
.build(),
135135
SolrCLI.OPTION_SOLRURL,
136136
SolrCLI.OPTION_SOLRURL_DEPRECATED,
137+
SolrCLI.OPTION_SOLRURL_DEPRECATED_SHORT,
137138
SolrCLI.OPTION_ZKHOST,
138139
SolrCLI.OPTION_ZKHOST_DEPRECATED,
139140
SolrCLI.OPTION_CREDENTIALS);

0 commit comments

Comments
 (0)