-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Refactor bulk update tags to fix issue with concurrently removing multiple tags #143543
Refactor bulk update tags to fix issue with concurrently removing multiple tags #143543
Conversation
14403f8
to
1f85820
Compare
Pinging @elastic/fleet (Team:Fleet) |
ctx._source.tags.removeAll(params.tagsToRemove); | ||
ctx._source.tags.addAll(params.tagsToAdd); |
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.
Why no just having that code block, instead of the replaceAll before?
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.
In the use case of renaming a tag, we don't want the order to change. This is covered by the replaceAll
logic to replace the tag in place.
x-pack/plugins/fleet/server/services/agents/update_agent_tags_action_runner.ts
Show resolved
Hide resolved
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.
code looks good to me 🚀 (not tested locally)
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
Fixing #142330
Refactored bulk update tags to use
updateByQuery
withscript
to add and remove agent tags.Using
conflicts: abort
setting, so that the retry task can try later for two concurrent update tags actions.This works as expected so that removing 2 tags from 50k agents quickly eventually succeeds.
Pending:
To verify:
create_agents.ts
scriptExisting scenarios should not be impacted by the refactor:
remove_2_tags_at_once_50k.mov
Kibana log entries showing the concurrent action execution:
Checklist