Skip to content

Ingest the oplog through hashed connectors - #2869

Open
delthas wants to merge 1 commit into
improvement/BB-906/hashed-connectors-managerfrom
improvement/BB-906/hashed-oplog-ingestion
Open

delthas wants to merge 1 commit into
improvement/BB-906/hashed-connectors-managerfrom
improvement/BB-906/hashed-oplog-ingestion

Conversation

@delthas

@delthas delthas commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Hand-written description (took me a while). I tried to do much more hand-written and rountrip work with AI. Let me know if it helps :)

This implements the oplog scaling design for the oplog populator (see https://github.com/scality/citadel/pull/375 for details).

The issue with the previous design was that:

  • Buckets without lifecycle/... rules weren't exported, but we need this for direct-to-cold
  • The number of connectors grew linearly with the number of buckets, which does not work if we have too many buckets

Instead, we listen to all buckets all the time, splitting load across N connectors, with a simple k = hash(bucket) % N.

This is implemented as an opt-out ingestion mode, so enabled by default, but can be disabled. The goal is to drop the previous mode entirely in the short term. (That is why I chose not to have an abstraction over possible modes etc. The goal is to have only one mode left, soon, and delete legacy code.)

This is part of a stack of 7 PRs: the lower ones add the building blocks and the manager, this one wires it in, and #2888 adds monitoring. Review bottom-up.

The general idea is:

  • I add a new ingestion mode, hashed, opt-out
  • We "reconcile" connectors every 15 seconds, taking care of
    • if a new install, adding our connectors
    • ensuring our connectors are ready/not failed
    • if a migration, properly pausing previous connectors, creating ours, then deleting previous ones. The migration is a bit tricky but properly explained in the code.

The connector name is:

  • a prefix (to ignore anything that's not ours at all),
  • then N and k
  • and a hash such that we can easily spot outdated pipelines

Issue: BB-906

@bert-e

bert-e commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Hello delthas,

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 ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/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.
/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.

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.16667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.41%. Comparing base (4d2875c) to head (c71bec8).

Files with missing lines Patch % Lines
extensions/oplogPopulator/OplogPopulator.js 79.16% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
...ns/oplogPopulator/OplogPopulatorConfigValidator.js 100.00% <ø> (ø)
extensions/oplogPopulator/OplogPopulator.js 91.08% <79.16%> (+1.60%) ⬆️

... and 7 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.25% <ø> (ø)
Core Library 83.69% <ø> (-0.09%) ⬇️
Ingestion 79.17% <ø> (ø)
Lifecycle 81.70% <ø> (ø)
Oplog Populator 89.80% <79.16%> (+0.27%) ⬆️
Replication 64.47% <ø> (ø)
Bucket Scanner 85.76% <ø> (ø)
@@                              Coverage Diff                              @@
##           improvement/BB-906/hashed-connectors-manager    #2869   +/-   ##
=============================================================================
  Coverage                                         77.41%   77.41%           
=============================================================================
  Files                                               214      214           
  Lines                                             14657    14681   +24     
=============================================================================
+ Hits                                              11347    11366   +19     
- Misses                                             3300     3305    +5     
  Partials                                             10       10           
Flag Coverage Δ
api:retry 9.02% <0.00%> (-0.02%) ⬇️
api:routes 8.87% <0.00%> (-0.02%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 10.48% <0.00%> (+0.95%) ⬆️
ingestion 12.53% <0.00%> (-0.03%) ⬇️
lib 8.80% <0.00%> (-0.03%) ⬇️
lifecycle 20.25% <0.00%> (-0.02%) ⬇️
notification 0.96% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.16% <0.00%> (-0.01%) ⬇️
replication 18.45% <0.00%> (-0.13%) ⬇️
unit 59.16% <79.16%> (+0.06%) ⬆️

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.

Comment thread extensions/oplogPopulator/modules/HashedConnectorsManager.js
Comment thread extensions/oplogPopulator/OplogPopulatorConfigValidator.js Outdated
@scality scality deleted a comment from bert-e Oct 8, 2026
@bert-e

bert-e commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@delthas
delthas marked this pull request as draft October 8, 2026 16:51
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from f512379 to d4b2816 Compare October 8, 2026 17:03
@delthas
delthas marked this pull request as ready for review October 8, 2026 17:05
Comment thread extensions/oplogPopulator/modules/HashedConnectorsManager.js
Comment thread monitoring/oplog-populator/alerts.yaml Outdated
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch 2 times, most recently from b02ea60 to aea4f4f Compare October 9, 2026 14:05
@bert-e

bert-e commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

The following approvals are needed before I can proceed with the merge:

  • the author

  • 2 peers

@scality scality deleted a comment from bert-e Oct 9, 2026
Comment thread extensions/oplogPopulator/modules/HashedConnectorsManager.js
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch 2 times, most recently from 6a15600 to d555261 Compare October 9, 2026 14:15
Comment thread extensions/oplogPopulator/modules/HashedConnectorsManager.js Outdated
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch 3 times, most recently from 3999fe6 to 7712a12 Compare October 13, 2026 11:12
Comment thread extensions/replication/ReplicationQueuePopulator.js Outdated
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 7712a12 to 342a7bb Compare October 13, 2026 11:28
Comment thread extensions/oplogPopulator/modules/HashedConnectorsManager.js Outdated
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 6f598c8 to 72575e3 Compare October 14, 2026 12:22
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 72575e3 to 9258cc1 Compare October 14, 2026 12:50
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 9258cc1 to ce2ef77 Compare October 14, 2026 12:58
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from ce2ef77 to c6bc788 Compare October 14, 2026 13:04
@delthas
delthas requested a review from DarkIsDude October 14, 2026 13:16

@DarkIsDude DarkIsDude left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

One comment

@delthas
delthas requested a review from DarkIsDude October 14, 2026 16:12
*/
async setup() {
if (this._config.ingestion === 'hashed') {
await this._setupHashed();

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.

that is a really hacky way to integrate (and dangerous: most API in this class will not work, since the fields are not set...), when the existing code already implements a whole reconcile loop... Not sure we can change now, though :/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@francoisferrand not sure to follow you on that 🙏 , can you explain more

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes it's intentionally "hacky"/minimal. I didnt want to have an abstraction with classes etc. since the goal is to remove all the code in the next release.

@francoisferrand francoisferrand Oct 15, 2026 •

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.

not sure to follow you on that 🙏 , can you explain more

this basically bypasses most of the code in this class (and all the rest of oplog populator) : almost like we ran 2 completely different oplog populations (if (process.env.NEW_OPLOG_POPULATOR) { require("newCode").start(); } else { require("oldCode").start(); }), with the added extra risk that we still perform half the initialization and use some of the existing bindings (health check...)

the old code already implemented a complete reconciliation process, here we just hack around to require some setup and bypass everything else - and not even cleanly by just starting one implementation or the other.

I didnt want to have an abstraction with classes etc. since the goal is to remove all the code in the next release.

I don't think the abstraction is the problem. What we want to remove (eventually) is the behavior, but the whole abstraction/framework was about splitting responsibility : it was proven to work, and probably flexible enough to address the new approach as well...

* @throws {InternalError}
*/
async _setupHashed() {
try {

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.

not sure what version backbeat currently works with, but certainly fine to drop support for older versions.

However, which versions are we talking about? We don't do very fancy stuff, what requires a specific version?

Comment thread extensions/oplogPopulator/OplogPopulator.js
Comment thread extensions/oplogPopulator/OplogPopulatorConfigValidator.js Outdated
Comment thread monitoring/oplog-populator/dashboard.py
Comment thread monitoring/oplog-populator/dashboard.py Outdated
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from c6bc788 to a7c898b Compare October 15, 2026 08:58

@DarkIsDude DarkIsDude left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some comments

@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch 2 times, most recently from edd21d0 to 153c045 Compare October 15, 2026 12:28
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 153c045 to 38c73fd Compare October 15, 2026 12:54
Comment thread monitoring/oplog-populator/alerts.test.yaml
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 38c73fd to 94effd8 Compare October 15, 2026 14:20
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 94effd8 to 4a6f28c Compare October 15, 2026 15:34
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from 4a6f28c to ac2d6b0 Compare October 15, 2026 17:40
The oplog populator now ingests the whole oplog through N hashed
connectors (numberOfConnectors), migrating any existing connector to
them. Setting `ingestion` to `perBucket`
(EXTENSIONS_OPLOG_POPULATOR_INGESTION) keeps the previous per-bucket
connectors; switching back deletes the hashed connectors and loses
events in between.

- Requires Kafka Connect >= 3.5 (offsets API): migrations wait until it
  is rolled out.
- Setup only schedules the reconciliation, so that probes answer while a
  migration waits for offsets to flush. Readiness no longer requires the
  metastore change stream, which hashed ingestion does not use.
- Without bucket changes to react to, connectors are reconciled every
  15s by default instead of every second.
- Connectors start at MongoDB's cluster time, not the pod's clock.

Issue: BB-906
@delthas
delthas force-pushed the improvement/BB-906/hashed-oplog-ingestion branch from ac2d6b0 to c71bec8 Compare October 15, 2026 17:56

This branch has not been deployed

No deployments
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.

4 participants