Skip to content

Support per-backend role and destination in replication engine#2743

Draft
maeldonn wants to merge 1 commit into
development/9.4from
improvement/BB-762/crr-multi
Draft

Support per-backend role and destination in replication engine#2743
maeldonn wants to merge 1 commit into
development/9.4from
improvement/BB-762/crr-multi

Conversation

@maeldonn
Copy link
Copy Markdown
Contributor

Read destination bucket and role from each backends[] entry instead of the shared top-level fields, so a single source object can be replicated to multiple CRR destinations with their own role. Legacy entries without per-backend fields keep working via top-level fallback in ObjectQueueEntry's site-aware getters; MongoQueueProcessor's oplog path now matches every applicable rule and dedups backends per the design's (site, destination, role) rule.

Issue: BB-762

Read destination bucket and role from each backends[] entry instead of
the shared top-level fields, so a single source object can be replicated
to multiple CRR destinations with their own role. Legacy entries
without per-backend fields keep working via top-level fallback in
ObjectQueueEntry's site-aware getters; MongoQueueProcessor's oplog path
now matches every applicable rule and dedups backends per the design's
(site, destination, role) rule.

Issue: BB-762
@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 27, 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 27, 2026

Incorrect fix version

The Fix Version/s in issue BB-762 contains:

  • None

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

  • 9.4.1

  • 9.5.0

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 91.25000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.68%. Comparing base (c52fbcc) to head (36b459a).

Files with missing lines Patch % Lines
extensions/mongoProcessor/MongoQueueProcessor.js 89.79% 5 Missing ⚠️
extensions/replication/tasks/ReplicateObject.js 87.50% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
...xtensions/replication/tasks/MultipleBackendTask.js 55.44% <100.00%> (ø)
lib/models/ObjectQueueEntry.js 92.77% <100.00%> (+1.46%) ⬆️
extensions/replication/tasks/ReplicateObject.js 91.73% <87.50%> (+0.52%) ⬆️
extensions/mongoProcessor/MongoQueueProcessor.js 69.92% <89.79%> (+0.51%) ⬆️

... and 5 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.22% <ø> (ø)
Core Library 80.80% <100.00%> (-0.19%) ⬇️
Ingestion 71.33% <89.79%> (+0.08%) ⬆️
Lifecycle 79.06% <ø> (ø)
Oplog Populator 85.83% <ø> (ø)
Replication 59.95% <88.23%> (+0.16%) ⬆️
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.4    #2743      +/-   ##
===================================================
- Coverage            74.73%   74.68%   -0.05%     
===================================================
  Files                  199      199              
  Lines                13650    13696      +46     
===================================================
+ Hits                 10201    10229      +28     
- Misses                3439     3457      +18     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.09% <0.00%> (-0.04%) ⬇️
api:routes 8.91% <0.00%> (-0.04%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.05% <0.00%> (-1.08%) ⬇️
lib 7.72% <0.00%> (-0.07%) ⬇️
lifecycle 18.83% <0.00%> (-0.17%) ⬇️
notification 1.02% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.14% <0.00%> (-0.01%) ⬇️
replication 18.77% <25.00%> (+0.04%) ⬆️
unit 51.93% <91.25%> (+0.69%) ⬆️

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

rule => rule.Status === 'Enabled' &&
entry.getObjectKey().startsWith(rule.Prefix) &&
rule.Destination &&
rule.Destination.StorageClass === this.site);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rules.find() picks the first matching rule in the API response, but MongoQueueProcessor._updateReplicationInfo selects backends from the highest-priority rule (via .sort((a, b) => (b.priority || 0) - (a.priority || 0))). If multiple enabled rules match the same object prefix and target the same StorageClass with different Destination.Account values, and the API returns them in non-priority order, the expectedDestRole derived here may differ from the role stored in the entry, causing a spurious BadRole rejection.

— Claude Code

@claude
Copy link
Copy Markdown

claude Bot commented May 27, 2026

  • ReplicateObject.js:310 — Rule matching via Rules.find() does not consider priority, while MongoQueueProcessor sorts by priority descending. If multiple rules target the same site with different Destination.Account values, the derived expectedDestRole may not match the entry's role, causing a spurious BadRole error.
    - tests/unit/lib/models/ObjectQueueEntry.spec.js — File shows as a binary diff in this PR, which typically indicates a BOM or encoding issue. Verify the file is clean UTF-8.

    Review by Claude Code

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.

2 participants