-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Adds checks to ensure index metadata exists when we try to use it #33455
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
Conversation
Pinging @elastic/es-core-infra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I left one optional comment. I've run into this issue a few times locally so it's good to fix it in as many places as possible
@@ -158,6 +158,10 @@ public void onFailure(Exception e) { | |||
} | |||
|
|||
private void runPolicy(IndexMetaData indexMetaData, ClusterState currentState) { | |||
if (indexMetaData == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think my preference would be to handle this in the caller of runPolicy
, what do you think? (I'm okay either way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moveToStep is the only caller of this method, so I am also more-or-less indifferent to where this goes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once CI is happy
Adds a null check for IndexMetaData similar to those in #33455.
Adds a null check for IndexMetaData similar to those in #33455.
IF the index no longer exists when we try to retrieve the index metadata it's been delete since the policy was triggered and there is nothing for us to do. Currently in a few places we throw a NPE if this happens which, although it does not affect the execution result is ugly and logs a needless stack trace which suggests something might be wrong even though its not. This change makes sure we check for when this happens, logs a debug message and then ignores execution of that index for whatever operation is in progress.