Skip to content

Accept object-valued value and overheadFields in kafka entries - #2807

Open
delthas wants to merge 2 commits into
development/9.6from
improvement/BB-847/accept-object-valued-entry-value
Open

Accept object-valued value and overheadFields in kafka entries#2807
delthas wants to merge 2 commits into
development/9.6from
improvement/BB-847/accept-object-valued-entry-value

Conversation

@delthas

@delthas delthas commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

createFromKafkaEntry parses the kafka message body and then parses the nested value — and, for del entries, overheadFields — a second time, so producers have to send them as JSON text.

The D/R metadata stream is built by a MongoDB change-stream pipeline (ZKOP-562), which cannot serialise a document to a string: there is no $toJson, and $convert rejects documents. Manufacturing one for the consumer to parse straight back would mean either $function (per-document server-side JS on a production secondary, inside a change-stream pipeline) or a custom Kafka Connect SMT shipped in the kafka-connect image.

The string requirement only exists because every producer so far builds entries in JavaScript — ListRecordStream does value: JSON.stringify(objectMd) on the oplog path, and S3C ingestion stringifies upstream. Nothing consumes the string form; it is parsed on receipt.

So decode these fields only when they are strings, and pass objects through. That is a superset of the existing format: producers that stringify take the identical path, so ingestion is unaffected.

The first commit moves the QueueEntry spec to tests/unit/lib/models/, next to the model it tests.

Issue: BB-847

createFromKafkaEntry coverage lived under tests/unit/replication/, while
tests/unit/lib/models/ mirrors the source layout and already holds the
sibling model specs. Pure relocation: only the two relative require
paths change.

Issue: BB-847
createFromKafkaEntry parsed the kafka message body and then parsed the
nested value (and overheadFields) a second time, requiring producers to
send them as JSON text. The D/R metadata stream is built by a MongoDB
change-stream pipeline, which cannot serialise a document to a string —
there is no $toJson and $convert rejects documents — so it can only emit
these fields as objects.

Decode them only when they are strings and pass objects through. This is
a superset of the existing format: producers that stringify, S3C
ingestion and the oplog reader, take the identical path.

A field that is neither a string nor an object now yields the usual
malformed-entry error naming the offending type. Previously JSON.parse
coerced it, so an entry whose value was a number reached ObjectQueueEntry
and passed checkSanity, since only bucket and key are checked.

Issue: BB-847
@bert-e

bert-e commented Aug 18, 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
/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 Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.75%. Comparing base (52b9510) to head (f8b8eb2).

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/models/QueueEntry.js 84.61% <100.00%> (+2.26%) ⬆️

... and 2 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.27% <ø> (ø)
Core Library 81.90% <100.00%> (-0.04%) ⬇️
Ingestion 70.09% <ø> (ø)
Lifecycle 80.46% <ø> (ø)
Oplog Populator 85.83% <ø> (ø)
Replication 62.01% <ø> (ø)
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.5    #2807      +/-   ##
===================================================
- Coverage            75.76%   75.75%   -0.02%     
===================================================
  Files                  200      200              
  Lines                13922    13927       +5     
===================================================
+ Hits                 10548    10550       +2     
- Misses                3364     3367       +3     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.10% <0.00%> (-0.01%) ⬇️
api:routes 8.87% <0.00%> (-0.01%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 10.39% <0.00%> (-0.60%) ⬇️
ingestion 12.26% <0.00%> (-0.01%) ⬇️
lib 8.82% <0.00%> (-0.01%) ⬇️
lifecycle 19.29% <0.00%> (-0.01%) ⬇️
notification 1.02% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.13% <0.00%> (-0.01%) ⬇️
replication 18.85% <42.85%> (+<0.01%) ⬆️
unit 54.90% <100.00%> (+0.01%) ⬆️

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.

@scality scality deleted a comment from bert-e Aug 18, 2026
@bert-e

bert-e commented Aug 18, 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 requested review from a team, benzekrimaha and francoisferrand August 18, 2026 15:16

@francoisferrand francoisferrand left a comment

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.

note: should land on 9.6 branch (waiting for "flaky" fix and 9.5.0 release) to create it

@scality scality deleted a comment from bert-e Aug 19, 2026
@delthas
delthas changed the base branch from development/9.5 to development/9.6 August 20, 2026 08:50
@delthas

delthas commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

note: should land on 9.6 branch (waiting for "flaky" fix and 9.5.0 release) to create it

Done

@scality scality deleted a comment from bert-e Aug 20, 2026
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