-
Notifications
You must be signed in to change notification settings - Fork 257
Bump microVersionId and add isReplica handling #6178
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
base: development/9.4
Are you sure you want to change the base?
Changes from all commits
0ea9851
36b204a
585f37b
a04afdb
2893d63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| const { versioning } = require('arsenal'); | ||
| const { config } = require('../../../Config'); | ||
|
|
||
| /** | ||
| * Bump objectMD.microVersionId. microVersionId is a generic | ||
| * metadata-revision marker, not a CRR-specific field, but cascaded CRR | ||
| * is its only consumer today - so we gate on replicationInfo to avoid | ||
| * inflating storage on objects that wouldn't use it. The gate can be | ||
| * widened later if another consumer needs it on every object. | ||
| * Pass `force = true` to bump unconditionally. | ||
| * | ||
| * @param {object} objectMD - object MD POJO or `md.getValue()` | ||
| * @param {boolean} [force] - bump even without replicationInfo | ||
| * @return {undefined} | ||
| */ | ||
| function bumpMicroVersionId(objectMD, force) { | ||
| if (!force && !objectMD?.replicationInfo) { | ||
| return; | ||
| } | ||
|
|
||
| const { instanceId, replicationGroupId } = config; | ||
|
|
||
| // eslint-disable-next-line no-param-reassign | ||
| objectMD.microVersionId = versioning.VersionID.generateVersionId(instanceId, replicationGroupId); | ||
|
francoisferrand marked this conversation as resolved.
|
||
| } | ||
|
|
||
| module.exports = bumpMicroVersionId; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,7 @@ function getReplicationInfo(s3config, objKey, bucketMD, isMD, objSize, operation | |
| content, | ||
| role: ReplicationConfiguration.resolveSourceRole(config.role), | ||
| isNFS: bucketMD.isNFS(), | ||
| isReplica: false, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mixed feeling on this : I say let's keep it, it makes sense as we return status pending, but also weird because we have objectMd available in the function, so we should return objectMd.isReplica 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intentional, same as hardcoding
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true, other fields are also hardcoded
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: since we need to keep "backwards" compatibility (i.e. support the missing |
||
| }; | ||
| } | ||
|
|
||
|
|
||
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.
nit : I think putting it in versioning.js instead of creating a new file could have been enough 🤔
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'd rather keep it as its own file:
versioning.jsis already 585 lines and handlesversionIdsemantics, whereasmicroVersionIdis a separate revision marker (used by cascaded CRR loop detection). Six call sites import it, so a focused helper file felt clearer than growingversioning.js. Happy to move it if you feel strongly though.