Skip to content

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Feb 11, 2026

https://issues.apache.org/jira/browse/SOLR-18118

Description

Populate the prompts that bin/solr start -e cloud makes with preset answers. Prompts.... in the old school sense of the word ;-)

This would be MOST valuable if we could backport it to 9x, so we can test 9 against 10. However, even if it only makes it into 10.1, well, we can test 11 and 10 ;-)

Solution

A bit of refactoring in how we read in choices. A new --prompt=2,8983,8984,"mycollection",2,2,_default setting that provides comma delimited values.

Tests

Added a test and manual testing.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 11, 2026
@epugh
Copy link
Contributor Author

epugh commented Feb 11, 2026

@rahulgoswami could you check out the bin/solr.cmd changes?

Copy link
Contributor

@malliaridis malliaridis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--prompt=2,8983,8984,"mycollection",2,2,_default

This seems kind of cryptic and the order can easily be messed up. It is very easy to make mistakes, imagine following scenarios:

User confuses the order of ports and shards / replicas, the prompt:

--prompts=2,2,2,"mycollection",8983,8984,_defaut

Or the user used

--prompts=2,8983,8984,"mycollection",2,2,_defaut

and now comes up with "oh, lets try 3 instead of 2 nodes" and just updates the prompts like

--prompts=3,8983,8984,"mycollection",2,2,_defaut

or user may think using it like

--prompts 3 8983 8984 "mycollection" 2 2 "_default"

So I feel like there are too many wrong inputs possible.

I would rather prefer more params where we clearly distinguish the input data too. If it is supposed for automation, we still should maintain the readability and avoid "magic numbers". I would personally prefer options like --node-count=2, --node-ports=8983,8984 and so on, so that it is at least clear what the user is setting and the order doesn't matter.

Although not exactly the same, clig.dev says:

If you’ve got two or more arguments for different things, you’re probably doing something wrong.
source

The windows script also fails with

> bin\solr.cmd start -e cloud --prompts 3,8983,8984,8985,"my_collection",6,3,"_default"

Invalid command-line option: 3

Usage: solr start [-f] [--user-managed] [...]

It seems that CMD is splitting the params by commas, so it fails after trying to parse the argument 3. In order to make it work I had to make the following changes:

:set_prompt
set "PASS_TO_RUN_EXAMPLE=--prompts %2 !PASS_TO_RUN_EXAMPLE!"

SHIFT # <-- Add a second shift to remove the argument of --prompts
SHIFT
goto parse_args

Additionally update --prompt to --prompts (see other comments), and then run the command as

> bin\solr.cmd start -e cloud --prompts "3,8983,8984,8985,my_collection,6,3,_default" 

so that it is not split by comma (annoying, I know).

With these changes it worked on Windows, but I do not like it so much. The texts that are printed give the false impression that the user is supposed to make some prompt (they should be suppressed instead).

The --prompts is also specific to --e cloud, is it supposed to work for the other examples as well? If not, should it be listed in the start command, if it is only valid for -e cloud?

@epugh
Copy link
Contributor Author

epugh commented Feb 11, 2026

yeah, so there are some weasel words in the description of --no-prompt and --prompts about why they only work on cloud. And yes, agree that it could be better! Also, I agree that the pattern is brittle, but I don't want to add a million params, at least, not yet. I think of --prompts as kind of an expert level feature. For example, in a load testing script i am working on. I don't want to add too much to it till i know it adds value!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:cli documentation Improvements or additions to documentation start-scripts tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants