Skip to content

oplogPopulator: route oplog key through TransformObjectKey SMT when available#2741

Open
delthas wants to merge 1 commit into
development/9.4from
improvement/BB-768/oplog-partition-by-object-key
Open

oplogPopulator: route oplog key through TransformObjectKey SMT when available#2741
delthas wants to merge 1 commit into
development/9.4from
improvement/BB-768/oplog-partition-by-object-key

Conversation

@delthas
Copy link
Copy Markdown
Contributor

@delthas delthas commented May 21, 2026

Summary

  • lib/wrappers/KafkaConnectWrapper: add getConnectorPlugins() (GET /connector-plugins).
  • extensions/oplogPopulator/constants.js: add defaultConnectorConfigSMT next to the legacy defaultConnectorConfig. The SMT variant projects documentKey._id in the key schema and includes the transforms.stripObjectKey.type=com.scality.kafka.connect.transforms.TransformObjectKey SMT + key.converter=StringConverter.
  • extensions/oplogPopulator/modules/ConnectorsManager.js: probe Kafka Connect for the SMT plugin in initializeConnectors and at the top of every scheduleConnectorUpdates tick. _getDefaultConnectorConfiguration consults _smtAvailable to pick the right base config. Single warn log per state transition; probe failures gracefully fall back to legacy.

Context

BB-768 fixes per-S3-object partitioning on the oplog Kafka topic. The current key projects fullDocument.value.key, which is null on update / delete events (since BB-355 removed change.stream.full.document=updateLookup). Update and delete events for any S3 object collapse onto a single partition while inserts spread across the topic — per-object ordering is broken across op types.

The actual fix lives in the Zenko-side SMT plugin shipped via ZENKO-5274, which derives the key from documentKey._id (always populated) and strips the arsenal master/version encoding so master and all versions of an S3 object hash to the same partition. This PR is the Backbeat side: it wires the connector config to use the SMT when the cluster's Kafka Connect image has the plugin installed.

Probing each reconciliation tick means an upgrade rollout that bumps the Kafka Connect image after Backbeat auto-activates the SMT config on the very next tick, without operator action. Clusters whose Connect image does not yet have the SMT keep running on the legacy key schema unchanged. The transition flips an existing connector in place via PUT /connectors/{name}/config — no recreate, no resume-token loss (the change touches the key schema + transforms only, not the pipeline match stage).

Issue: BB-768

@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 21, 2026

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
/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.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.79%. Comparing base (cb059e2) to head (3f61602).
⚠️ Report is 6 commits behind head on development/9.4.

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
extensions/oplogPopulator/constants.js 100.00% <100.00%> (ø)
...nsions/oplogPopulator/modules/ConnectorsManager.js 95.20% <100.00%> (+1.13%) ⬆️
lib/wrappers/KafkaConnectWrapper.js 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.22% <ø> (ø)
Core Library 81.03% <100.00%> (-0.26%) ⬇️
Ingestion 71.24% <ø> (ø)
Lifecycle 79.06% <ø> (ø)
Oplog Populator 86.63% <100.00%> (+0.80%) ⬆️
Replication 59.67% <ø> (-0.08%) ⬇️
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.4    #2741      +/-   ##
===================================================
- Coverage            74.84%   74.79%   -0.05%     
===================================================
  Files                  199      199              
  Lines                13630    13671      +41     
===================================================
+ Hits                 10201    10225      +24     
- Misses                3419     3436      +17     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.11% <0.00%> (-0.03%) ⬇️
api:routes 8.93% <0.00%> (-0.03%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 10.84% <0.00%> (-0.06%) ⬇️
ingestion 12.55% <0.00%> (-0.04%) ⬇️
lib 7.58% <0.00%> (-0.03%) ⬇️
lifecycle 18.77% <0.00%> (-0.06%) ⬇️
notification 1.02% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.17% <9.75%> (+0.02%) ⬆️
replication 18.38% <0.00%> (-0.17%) ⬇️
unit 51.33% <100.00%> (+0.14%) ⬆️

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/ConnectorsManager.js Outdated
Comment thread extensions/oplogPopulator/modules/ConnectorsManager.js
@delthas delthas force-pushed the improvement/BB-768/oplog-partition-by-object-key branch from 650dd4e to 396d23b Compare May 21, 2026 15:05
Comment thread extensions/oplogPopulator/modules/ConnectorsManager.js
@scality scality deleted a comment from claude Bot May 21, 2026
@delthas delthas force-pushed the improvement/BB-768/oplog-partition-by-object-key branch from 396d23b to 55af2e9 Compare May 21, 2026 15:41
@bert-e
Copy link
Copy Markdown
Contributor

bert-e commented May 21, 2026

Request integration branches

Waiting for integration branch creation to be requested by the user.

To request integration branches, please comment on this pull request with the following command:

/create_integration_branches

Alternatively, the /approve and /create_pull_requests commands will automatically
create the integration branches.

@scality scality deleted a comment from bert-e May 21, 2026
@scality scality deleted a comment from claude Bot May 21, 2026
…vailable

Probes the Kafka Connect cluster for the
com.scality.kafka.connect.transforms.TransformObjectKey SMT plugin
(shipped by Zenko via ZENKO-5274) on every reconciliation tick. When
the plugin is loaded, the assembled connector config uses a key
schema projecting documentKey._id (always populated on every change
event) and adds the SMT to strip the arsenal master/version
encoding, so master and all versions of the same S3 object hash to
the same Kafka partition. When the plugin is absent (cluster on an
older Connect image or during a rolling upgrade), the legacy
fullDocument.value.key schema is used unchanged.

Reconciliation flow is unchanged: the existing config-diff path
PUTs the new config to /connectors/{name}/config in place, so no
recreate, no resume-token loss. The probe is graceful on REST
errors (falls back to legacy + a single warn log per state change).

* lib/wrappers/KafkaConnectWrapper: add getConnectorPlugins.
* extensions/oplogPopulator/constants: add defaultConnectorConfigSMT
  alongside defaultConnectorConfig; expose the SMT FQCN as
  transformObjectKeyClass.
* extensions/oplogPopulator/modules/ConnectorsManager: probe in
  initializeConnectors and at the top of each scheduleConnectorUpdates
  tick; _getDefaultConnectorConfiguration consults _smtAvailable.

Issue: BB-768
@delthas delthas force-pushed the improvement/BB-768/oplog-partition-by-object-key branch from 55af2e9 to 3f61602 Compare May 21, 2026 15:46
@claude
Copy link
Copy Markdown

claude Bot commented May 21, 2026

LGTM — clean design and solid edge-case handling.

- Feature detection via /connector-plugins probe is the right approach for zero-touch upgrade rollouts
- Legacy fallback + smtOnlyConfigKeys scrubbing correctly prevents stale SMT references from breaking connectors when the plugin disappears
- _applyKeyConfig propagation on state flip ensures running connectors pick up the change without restart or resume-token loss
- Test coverage is thorough: both flip directions, no-op when state unchanged, stale-key scrubbing in _processOldConnectors, and probe-before-update ordering in scheduleConnectorUpdates

Review by Claude Code

@scality scality deleted a comment from claude Bot May 21, 2026
@delthas delthas marked this pull request as ready for review May 22, 2026 15:36
@delthas delthas requested a review from francoisferrand May 22, 2026 15:40
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