-
Notifications
You must be signed in to change notification settings - Fork 25.6k
ES-10936 Include project ID in enrich cache key #128908
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
ES-10936 Include project ID in enrich cache key #128908
Conversation
This prevents collisions in the enrich cache for different projects. Collisions would be unlikely without this chance, since the key includes the index name, and the index name includes a millisecond-precision timestamp, so it would only happen if two projects executed enrich policies with the same name at the same time, or if one project manipulated the alias to match the timestamp of the other project. However, collisions would have serious consequences (allowing read-across of data between projects). This change closes that gap.
7ebab8d to
a7c4467
Compare
|
Pinging @elastic/es-data-management (Team:Data Management) |
nielsbauman
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
| */ | ||
| // Visibility for testing | ||
| record CacheKey(String enrichIndex, Object lookupValue, int maxMatches) { | ||
| record CacheKey(String enrichIndex, ProjectId projectId, Object lookupValue, int maxMatches) { |
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.
Tiniest nit ever: intuitively, I would have put the project ID as the first parameter because it has the largest "scope". Maybe that's just a weird personal preference I have, so this is definitely optional.
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.
No, that makes sense. Done, and thanks.
This prevents collisions in the enrich cache for different projects.
Collisions would be unlikely without this chance, since the key includes the index name, and the index name includes a millisecond-precision timestamp, so it would only happen if two projects executed enrich policies with the same name at the same time, or if one project manipulated the alias to match the timestamp of the other project.
However, collisions would have serious consequences (allowing read-across of data between projects). This change closes that gap.