Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions changelog/unreleased/SOLR-18269.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# (DELETE ALL COMMENTS UP HERE AFTER FILLING THIS IN

# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc

# If the change is minor, don't bother adding a changelog entry.
# For `other` type entries, the threshold to bother with a changelog entry should be even higher.

# title:
# * The audience is end-users and administrators, not committers.
# * Be short and focused on the user impact. Multiple sentences is fine!
# * For technical/geeky details, prefer the commit message instead of changelog.
# * Reference JIRA issues like `SOLR-12345`, or if no JIRA but have a GitHub PR then `PR#12345`.

# type:
# `added` for new features/improvements, opt-in by the user typically documented in the ref guide
# `changed` for improvements; not opt-in
# `fixed` for improvements that are deemed to have fixed buggy behavior
# `deprecated` for marking things deprecated
# `removed` for code removed
# `dependency_update` for updates to dependencies
# `other` for anything else, like large/significant refactorings, build changes,
# test infrastructure, or documentation.
# Most such changes are too small/minor to bother with a changelog entry.

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
16 changes: 16 additions & 0 deletions solr/bin/solr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions solr/bin/solr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions solr/packaging/test/test_start_solr.bats
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,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"

Expand Down
Loading