Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17495: Change CLI delete command to not delete configs by default. #2761

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

epugh
Copy link
Contributor

@epugh epugh commented Oct 12, 2024

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

Description

See jira

Solution

Makes --delete-config a opt in flag that specifies the user wants to delete their config along with their collection.

This would be a 10x only change since we are changing the feature.

Tests

Bats

@github-actions github-actions bot added documentation Improvements or additions to documentation tests cat:cli labels Oct 12, 2024
@epugh
Copy link
Contributor Author

epugh commented Oct 12, 2024

@malliaridis

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.

Thanks for the PR. I would like to notify somehow the user about the change of the default behavior by showing a message when using the delete tool, but I am not sure if there is a specific way to do so. This would only affect 9x.

We definitely have to mention that in the migration guide from 9 to 10.

A few more points to look into the bevario change:

  • solr-control-script-reference.adoc#799-800: the behavior described is outdated
  • solr/packaging/test/bats_helper.bash#74: Previously delete_all_collections delete configs as well if no longer used (old behavior)
  • solr/packaging/test/test_basic_auth.bats#60: we should probably delete the config explicitly here and check for its deletion
  • solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc#491: we could probably delete the config explicitily here as well
  • solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc#484: we could probably delete the config explicitily here as well

Comment on lines 201 to 196
boolean deleteConfig = true;
boolean deleteConfig = false;
if (cli.hasOption("delete-config")) {
deleteConfig = "true".equals(cli.getOptionValue("delete-config"));
deleteConfig = true;
} else if (cli.hasOption("d")) {
deleteConfig = "true".equals(cli.getOptionValue("d"));
deleteConfig = true;
} else if (cli.hasOption("deleteConfig")) {
deleteConfig = "true".equals(cli.getOptionValue("deleteConfig"));
deleteConfig = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it more readable if replaced by the following?

Suggested change
boolean deleteConfig = true;
boolean deleteConfig = false;
if (cli.hasOption("delete-config")) {
deleteConfig = "true".equals(cli.getOptionValue("delete-config"));
deleteConfig = true;
} else if (cli.hasOption("d")) {
deleteConfig = "true".equals(cli.getOptionValue("d"));
deleteConfig = true;
} else if (cli.hasOption("deleteConfig")) {
deleteConfig = "true".equals(cli.getOptionValue("deleteConfig"));
deleteConfig = true;
boolean deleteConfig = cli.hasOption("delete-config")
|| cli.hasOption("deleteConfig")
|| cli.hasOption("d");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Love it... I can't merge directly from the UI for some reason so applying manually.

@epugh
Copy link
Contributor Author

epugh commented Oct 14, 2024

Leaving "tutorial-films.adoc" and "tutorial-techproducts.adoc" alone, as they default configs like _default and we wouldn't want to delete it.

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 tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants