-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
storage: Handle multi-bundle data with overlapping roots #5005
storage: Handle multi-bundle data with overlapping roots #5005
Conversation
5795bb0
to
a7dc478
Compare
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 -- One question regarding backwards-compatibility and if we do (and need to) break it.
// BasePaths indicates the top-level paths where write operations will be performed in this transaction. | ||
BasePaths []string | ||
|
||
// RootOverwrite is deprecated. Use BasePaths instead. | ||
RootOverwrite bool |
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.
Would code using the TransactionParams before now break because BasePaths
doesn't equal ""? Or do we handle that backwards-compatibly via RootOverwrite
? 🤔
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.
Good point. We can support backwards-compatibly via RootOverwrite
for now and then remove it in a future release. Updated the code.
8fa094c
to
b7c2b0e
Compare
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, one question
If the bundles being activated share a manifest root prefix, it would result in overwriting the bundle data based on the activation order. This happened since the truncate call writes data to the store based on the top-level keys in the data. When multiple bundles with overlapping bundle root prefixes are being activated as part of the same txn, adding data to the store by iterating over the top-level keys in the data object would result in an unintended overwrite. The truncate call would be able to properly write data if it had knowledge of the bundle roots. This commit passes the bundle roots to the truncate call to assist in writing data to the store. Fixes: open-policy-agent#4998 Signed-off-by: Ashutosh Narkar <[email protected]>
b7c2b0e
to
552b58d
Compare
If the bundles being activated share a manifest root prefix, it
would result in overwriting the bundle data based on the activation
order. This happened since the truncate call writes data to the
store based on the top-level keys in the data. When multiple
bundles with overlapping bundle root prefixes are being activated
as part of the same txn, adding data to the store by iterating
over the top-level keys in the data object would result in an unintended
overwrite. The truncate call would be able to properly write
data if it had knowledge of the bundle roots. This commit passes
the bundle roots to the truncate call to assist in writing data
to the store.
Fixes: #4998
Signed-off-by: Ashutosh Narkar [email protected]