This is an automated email from the ASF dual-hosted git repository. epugh pushed a commit to branch branch_10x in repository https://gitbox.apache.org/repos/asf/solr.git
commit 6723884e8561e989ee3cf4939045c4471c3413b6 Author: Eric Pugh <[email protected]> AuthorDate: Wed Jun 3 10:34:25 2026 -0400 SOLR-18269: Restore -c as a no-op function for bin/solr start (#4473) Signed-off-by: Eric Pugh <[email protected]> (cherry picked from commit c2123ca736c53cc038001cb7f19509fbbd0e62b3) --- changelog/unreleased/SOLR-18269.yml | 7 +++++++ solr/bin/solr | 16 ++++++++++++++++ solr/bin/solr.cmd | 17 +++++++++++++++++ solr/packaging/test/test_start_solr.bats | 8 ++++++++ 4 files changed, 48 insertions(+) diff --git a/changelog/unreleased/SOLR-18269.yml b/changelog/unreleased/SOLR-18269.yml new file mode 100644 index 00000000000..4e87550fdf0 --- /dev/null +++ b/changelog/unreleased/SOLR-18269.yml @@ -0,0 +1,7 @@ +title: Restore -c option as a no-op to bin/solr start script to simplify scripts that interact with both Solr 10 and previous versions of Solr. +type: changed +authors: + - name: Eric Pugh +links: + - name: SOLR-18269 + url: https://issues.apache.org/jira/browse/SOLR-18269 diff --git a/solr/bin/solr b/solr/bin/solr index eaa417ca90d..e61808d080c 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -682,11 +682,27 @@ SOLR_OPTS=(${SOLR_OPTS:-}) SCRIPT_SOLR_OPTS=() PASS_TO_RUN_EXAMPLE=() SOLR_MODE="solrcloud" +CLOUD_FLAG_SET=false +USER_MANAGED_FLAG_SET=false if [ $# -gt 0 ]; then while true; do case "${1:-}" in + -c|--cloud|-cloud) + if [[ "$USER_MANAGED_FLAG_SET" == "true" ]]; then + print_usage "$SCRIPT_CMD" "Cannot combine -c/--cloud with --user-managed; choose one." + exit 1 + fi + echo "WARNING: -c/--cloud is a no-op. Solr starts in cloud mode by default." + CLOUD_FLAG_SET=true + shift + ;; --user-managed) + if [[ "$CLOUD_FLAG_SET" == "true" ]]; then + print_usage "$SCRIPT_CMD" "Cannot combine -c/--cloud with --user-managed; choose one." + exit 1 + fi + USER_MANAGED_FLAG_SET=true SOLR_MODE="user-managed" PASS_TO_RUN_EXAMPLE+=("--user-managed") shift diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index e30cc4416fa..743d8fb7cdc 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -383,6 +383,9 @@ IF "%1"=="--foreground" goto set_foreground_mode IF "%1"=="--verbose" goto set_verbose IF "%1"=="-q" goto set_warn IF "%1"=="--quiet" goto set_warn +IF "%1"=="-c" goto set_cloud_mode +IF "%1"=="-cloud" goto set_cloud_mode +IF "%1"=="--cloud" goto set_cloud_mode IF "%1"=="--user-managed" goto set_user_managed_mode IF "%1"=="--server-dir" goto set_server_dir IF "%1"=="--solr-home" goto set_solr_home_dir @@ -444,7 +447,21 @@ set SOLR_LOG_LEVEL=WARN SHIFT goto parse_args +:set_cloud_mode +IF "%SOLR_MODE%"=="user-managed" ( + set "SCRIPT_ERROR=Cannot combine -c/--cloud with --user-managed; choose one." + goto invalid_cmd_line +) +@echo WARNING: -c/--cloud is a no-op. Solr starts in cloud mode by default. +set CLOUD_FLAG_SET=true +SHIFT +goto parse_args + :set_user_managed_mode +IF "%CLOUD_FLAG_SET%"=="true" ( + set "SCRIPT_ERROR=Cannot combine -c/--cloud with --user-managed; choose one." + goto invalid_cmd_line +) set SOLR_MODE=user-managed set "PASS_TO_RUN_EXAMPLE=--user-managed !PASS_TO_RUN_EXAMPLE!" SHIFT diff --git a/solr/packaging/test/test_start_solr.bats b/solr/packaging/test/test_start_solr.bats index 82e4e7cef67..4fa1f3a3434 100644 --- a/solr/packaging/test/test_start_solr.bats +++ b/solr/packaging/test/test_start_solr.bats @@ -94,6 +94,14 @@ teardown() { solr assert --started http://localhost:${SOLR_PORT} --timeout 5000 } +@test "-c flag prints no-op warning and still starts in cloud mode" { + run solr start -c + assert_output --partial 'WARNING: -c/--cloud is a no-op. Solr starts in cloud mode by default.' + + solr assert --started http://localhost:${SOLR_PORT} --timeout 5000 + solr assert --cloud http://localhost:${SOLR_PORT} --timeout 5000 +} + @test "bootstrapping a configset" { local confdir_path="${SOLR_TIP}/server/solr/configsets/sample_techproducts_configs/conf"
