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

Warmers delete _all should not throw exception when no warmers #13058

Closed

Conversation

andrestc
Copy link
Contributor

I think this fixes #8991. It will not throw exceptions when the request is to delete "_all" warmers but log it.

@jpountz jpountz changed the title Closes #8991: Warmers delete _all should not throw exception when no warmers Warmers delete _all should not throw exception when no warmers Aug 24, 2015
@javanna javanna self-assigned this Aug 24, 2015
@@ -92,6 +92,7 @@ public ClusterState execute(ClusterState currentState) {
MetaData.Builder mdBuilder = MetaData.builder(currentState.metaData());

boolean globalFoundAtLeastOne = false;
boolean deleteAll = Arrays.asList(request.names()).contains("_all");
Copy link
Member

Choose a reason for hiding this comment

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

can we use the MetaData.ALL constant here? and maybe just iterate over the array instead of creating a list just for that?

@javanna
Copy link
Member

javanna commented Aug 24, 2015

Thanks for the PR @andrestc I reviewed it and left two comments, would it be possible also to write a test around this change please?

@javanna javanna removed the review label Aug 24, 2015
@andrestc
Copy link
Contributor Author

@javanna Thanks for the review. Will work on it!

@andrestc
Copy link
Contributor Author

@javanna I've updated the PR with your observations.
Thanks!

boolean deleteAll = false;
for (int i=0; i<request.names().length; i++){
if (request.names()[i].equals(MetaData.ALL)) {
deleteAll = true;
Copy link
Member

Choose a reason for hiding this comment

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

mmm you need a break here otherwise deleteAll will be true only if the last index name is _all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think thats needed, but I'll add it because we can leave the loop as soon as we find it.

@javanna
Copy link
Member

javanna commented Aug 26, 2015

Thanks @andrestc I did another round and left a couple of minor comments, looks good though.

@andrestc
Copy link
Contributor Author

@javanna thanks! I will work on them today and submit it again later.

@andrestc
Copy link
Contributor Author

@javanna I've updated the PR.
Is there any difference in adding a random test case and doing what I did?

Thanks!

@javanna
Copy link
Member

javanna commented Aug 26, 2015

LGTM thanks @andrestc I will merge this soon.

Is there any difference in adding a random test case and doing what I did?

you test is fine, thanks!

javanna pushed a commit to javanna/elasticsearch that referenced this pull request Aug 27, 2015
@javanna javanna closed this in 793fcb6 Aug 27, 2015
@javanna
Copy link
Member

javanna commented Aug 27, 2015

merged 793fcb6 thanks @andrestc !

javanna pushed a commit to javanna/elasticsearch that referenced this pull request Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

warmers delete _all Exception
3 participants