Skip to content

Bump microVersionId and add isReplica handling#6178

Open
maeldonn wants to merge 4 commits into
development/9.4from
improvement/CLDSRV-906/micro-version-id
Open

Bump microVersionId and add isReplica handling#6178
maeldonn wants to merge 4 commits into
development/9.4from
improvement/CLDSRV-906/micro-version-id

Conversation

@maeldonn
Copy link
Copy Markdown
Contributor

Cloudserver-side prep for cascaded CRR (design): bumps arsenal to the improvement/ARSN-578/micro-version-id branch, bumps microVersionId on every user-facing object metadata write through a single bumpMicroVersionId helper (gated on replicationInfo presence to keep storage tight, with a force flag preserving the existing overwriting-version path), sources x-amz-replication-status from the new ReplicationInfo.isReplica field with a legacy status === 'REPLICA' fallback, and clears isReplica on direct user writes (tagging / ACL / retention / legal hold) so a modified replica stops looking like one. The backbeat-route side of the design (setting isReplica = true on incoming replicas, cascade comparison, MultiBackend guard) lands in a follow-up ticket — until then the new fields are read but never set, so observable behavior is unchanged.

Issue: CLDSRV-906

maeldonn added 4 commits May 28, 2026 23:42
Prefer ReplicationInfo.isReplica over replicationInfo.status when
producing x-amz-replication-status. The legacy status === 'REPLICA'
branch is kept as a fallback so objects written before the feature
still surface the correct value.

Issue: CLDSRV-906
Bump microVersionId on every user write that changes object metadata
other than replicationInfo, providing a unique revision identifier
needed by upcoming cascaded CRR loop detection.

Issue: CLDSRV-906
When a user updates tags, ACL, retention, or legal-hold on an object
that arrived via replication (isReplica=true), the resulting object is
no longer a replica - clear the flag so the x-amz-replication-status
response header reflects the new state.

Issue: CLDSRV-906
@maeldonn maeldonn requested review from a team, benzekrimaha and delthas May 29, 2026 08:13
@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 29, 2026

Hello maeldonn,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval
/bypass_build_status Bypass the build and test status
/bypass_commit_size Bypass the check on the size of the changeset TBA
/bypass_incompatible_branch Bypass the check on the source branch prefix
/bypass_jira_check Bypass the Jira issue check
/bypass_peer_approval Bypass the pull request peers' approval
/bypass_leader_approval Bypass the pull request leaders' approval
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request TBA
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 29, 2026

Incorrect fix version

The Fix Version/s in issue CLDSRV-906 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.4.0

Please check the Fix Version/s of CLDSRV-906, or the target
branch of this pull request.

Comment thread package.json
"@hapi/joi": "^17.1.1",
"@smithy/node-http-handler": "^3.0.0",
"arsenal": "git+https://github.com/scality/Arsenal#8.4.2",
"arsenal": "git+https://github.com/scality/Arsenal#improvement/ARSN-578/micro-version-id",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arsenal is pinned to a branch (improvement/ARSN-578/micro-version-id) instead of a tag. Git-based deps should be pinned to a tag for reproducible builds.

— Claude Code

const bumpMicroVersionId = require('../../../../../lib/api/apiUtils/object/bumpMicroVersionId');

describe('bumpMicroVersionId', () => {
it('sets a fresh microVersionId when replicationInfo is present', () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test names using it() should start with "should".

Suggested change
it('sets a fresh microVersionId when replicationInfo is present', () => {
it('should set a fresh microVersionId when replicationInfo is present', () => {

— Claude Code


afterEach(() => cleanup());

it('sets microVersionId on objectPut', async () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test names using it() should start with "should".

Suggested change
it('sets microVersionId on objectPut', async () => {
it('should set microVersionId on objectPut', async () => {

— Claude Code

@claude
Copy link
Copy Markdown

claude Bot commented May 29, 2026

  • arsenal is pinned to a branch instead of a tag in package.json — git-based deps must pin to a tag for reproducible builds.
    - Test names in tests/unit/api/apiUtils/object/bumpMicroVersionId.js and tests/unit/api/objectReplicationMD.js should start with "should".

    Review by Claude Code

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.24%. Comparing base (580d648) to head (3b4110b).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/api/apiUtils/object/bumpMicroVersionId.js 85.71% 1 Missing ⚠️
lib/api/objectDeleteTagging.js 75.00% 1 Missing ⚠️
lib/api/objectPutLegalHold.js 75.00% 1 Missing ⚠️
lib/api/objectPutRetention.js 75.00% 1 Missing ⚠️
lib/api/objectPutTagging.js 75.00% 1 Missing ⚠️
lib/metadata/acl.js 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/services.js 87.43% <100.00%> (ø)
lib/utilities/collectResponseHeaders.js 100.00% <100.00%> (ø)
lib/api/apiUtils/object/bumpMicroVersionId.js 85.71% <85.71%> (ø)
lib/api/objectDeleteTagging.js 98.27% <75.00%> (-1.73%) ⬇️
lib/api/objectPutLegalHold.js 93.10% <75.00%> (-1.35%) ⬇️
lib/api/objectPutRetention.js 94.28% <75.00%> (-1.17%) ⬇️
lib/api/objectPutTagging.js 98.36% <75.00%> (-1.64%) ⬇️
lib/metadata/acl.js 97.50% <75.00%> (-1.19%) ⬇️
@@                 Coverage Diff                 @@
##           development/9.4    #6178      +/-   ##
===================================================
- Coverage            85.25%   85.24%   -0.02%     
===================================================
  Files                  208      209       +1     
  Lines                13919    13948      +29     
===================================================
+ Hits                 11867    11890      +23     
- Misses                2052     2058       +6     
Flag Coverage Δ
file-ft-tests 68.84% <81.81%> (+0.02%) ⬆️
kmip-ft-tests 28.15% <39.39%> (+0.02%) ⬆️
mongo-v0-ft-tests 70.11% <81.81%> (+0.12%) ⬆️
mongo-v1-ft-tests 70.01% <81.81%> (-0.06%) ⬇️
multiple-backend 36.65% <57.57%> (+0.03%) ⬆️
sur-tests 35.46% <42.42%> (-0.91%) ⬇️
sur-tests-inflights 37.37% <42.42%> (+0.02%) ⬆️
utapi-v2-tests 34.80% <48.48%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +80 to +91
if (objectMD.replicationInfo?.isReplica) {
// eslint-disable-next-line no-param-reassign
objectMD.replicationInfo.isReplica = false;
}
const replicationInfo = getReplicationInfo(config,
objectKey, bucket, true, 0, REPLICATION_ACTION, objectMD);
if (replicationInfo) {
// eslint-disable-next-line no-param-reassign
objectMD.replicationInfo = Object.assign({},
objectMD.replicationInfo, replicationInfo);
}
bumpMicroVersionId(objectMD);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (objectMD.replicationInfo?.isReplica) {
// eslint-disable-next-line no-param-reassign
objectMD.replicationInfo.isReplica = false;
}
const replicationInfo = getReplicationInfo(config,
objectKey, bucket, true, 0, REPLICATION_ACTION, objectMD);
if (replicationInfo) {
// eslint-disable-next-line no-param-reassign
objectMD.replicationInfo = Object.assign({},
objectMD.replicationInfo, replicationInfo);
}
bumpMicroVersionId(objectMD);
const replicationInfo = getReplicationInfo(config, objectKey, bucket, true, 0, REPLICATION_ACTION, objectMD);
if (replicationInfo) {
// eslint-disable-next-line no-param-reassign
objectMD.replicationInfo = Object.assign({},
objectMD.replicationInfo, replicationInfo);
if (objectMD.replicationInfo?.isReplica) {
// eslint-disable-next-line no-param-reassign
objectMD.replicationInfo.isReplica = false;
}
bumpMicroVersionId(objectMD);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same in all files...)

Comment on lines +91 to +94
if (objectMD.replicationInfo?.isReplica) {
// eslint-disable-next-line no-param-reassign
objectMD.replicationInfo.isReplica = false;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be handled in getReplicationInfo ? (I think this function is not really a getter, but really "builds" the new replication info...)

const { instanceId, replicationGroupId } = config;

// eslint-disable-next-line no-param-reassign
objectMD.microVersionId = versioning.VersionID.generateVersionId(instanceId, replicationGroupId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a method ObjectMD.updateMicroVersionId() in arsenal ? should it not be used instead?

(if we can't because of POJO, then I wonder if that function was really useful....)

Comment thread lib/services.js
if (updateMicroVersionId) {
md.updateMicroVersionId();
}
bumpMicroVersionId(md.getValue(), updateMicroVersionId);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • is this not redundant with the other calls in APIs ?
  • calling it here we ALWAYS generate a new microVersionId when creating a new object: which is not needed since it comes with a new versionId... (except for non-versioned case, but no replication there: so the function does nothing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants