-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Remove enrich indices on delete policy #45870
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
When a policy is deleted, the enrich indices that are backing the policy alias should also be deleted. This commit does that work and cleans up the transport action a bit so that the lock release is easier to see, as well as to ensure that any action carried out, regardless of exception, unlocks the policy.
|
Pinging @elastic/es-core-features |
jbaiera
left a comment
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 Left a quick blurb about being apprehensive about using locks outside of a try-catch-finally mechanism but I think it might be out of scope for this PR
| if (policy == null) { | ||
| throw new ResourceNotFoundException("policy [{}] not found", request.getName()); | ||
| } | ||
| enrichPolicyLocks.lockPolicy(request.getName()); |
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 know that this line isn't from this PR but I'm wondering if it makes sense if we can get this to unlock from within a catch or finally block? I'm mostly paranoid about some benign exception being thrown anywhere that isn't expected and the policy becoming locked forever. Might require some restructuring here though and maybe not appropriate for this PR?
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.
It would be quite simple to do in this PR. I already had to add release logic to this PR, so i can just move it and remove a bit of code in the process.
martijnvg
left a comment
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
jbaiera
left a comment
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, thanks for making those locking changes
When a policy is deleted, the enrich indices that are backing the policy alias should also be deleted. This commit does that work and cleans up the transport action a bit so that the lock release is easier to see, as well as to ensure that any action carried out, regardless of exception, unlocks the policy.
When a policy is deleted, the enrich indices that are backing the policy
alias should also be deleted. This commit does that work and cleans up
the transport action a bit so that the lock release is easier to see, as
well as to ensure that any action carried out, regardless of exception,
unlocks the policy.