Skip to content

Consume from the earliest offset where a lost message is unrecoverable - #2794

Open
delthas wants to merge 1 commit into
development/9.5from
improvement/BB-831/consumers-from-offset-earliest
Open

Consume from the earliest offset where a lost message is unrecoverable#2794
delthas wants to merge 1 commit into
development/9.5from
improvement/BB-831/consumers-from-offset-earliest

Conversation

@delthas

@delthas delthas commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Pins fromOffset: 'earliest' on the three consumers where a message produced during a consumer group gap is permanently lost and the group is service-wide rather than created per site or per destination:

Topic Consumer
backbeat-lifecycle-transition-tasks transition processor
cold-status-<location> transition processor, per location
gc topic GarbageCollector

Four consumers deliberately stay on the default: the lifecycle object (expiration) tasks topic (self-healing via the conductor's re-enumeration), the notification internal topic and the data-mover topic (both use a per-instance group id on a shared topic, so a new destination or location would replay the full retention window), and the replication topic itself (replay cost needs its own decision). A unit test pins the expiration exclusion so it is not "fixed" by accident.

The per-consumer rationale — why each loss is or is not recoverable, and the replay-safety analysis behind each decision — is in BB-831.

Validation

On a 30-run census with an earlier build of this fix, the Azure Archive location CRUD scenario went from 8/20 runs failing (40 %) to 1/30 (3.3 %), and no skip of this kind appears in any of the dumps inspected. Pre-fix, cold-status messages produced but never consumed ran at 15–34 % across two censuses, concentrated in the rollout window and absent outside it, and the mechanism was traced end to end in every case examined — all of them cold-status. Caveats: an unrelated fix touching cold transitions landed between censuses, and the validated build's consumer set is wider than what this PR now pins, so the attribution rests on the traced mechanism rather than on the rate alone.

Implementation note

The gc consumer options move into _getConsumerOptions() for unit coverage, following #2788. Generic fromOffset semantics are already covered by the functional tests #2788 added to the BackbeatConsumer suite.

Issue: BB-831

@bert-e

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

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.47%. Comparing base (99c1281) to head (891f7af).
⚠️ Report is 10 commits behind head on development/9.5.

Files with missing lines Patch % Lines
extensions/gc/GarbageCollector.js 33.33% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
...ectProcessor/LifecycleObjectTransitionProcessor.js 79.45% <100.00%> (+8.61%) ⬆️
extensions/gc/GarbageCollector.js 46.37% <33.33%> (+0.78%) ⬆️

... and 4 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.22% <ø> (ø)
Core Library 81.21% <ø> (-0.16%) ⬇️
Ingestion 70.13% <ø> (ø)
Lifecycle 80.46% <50.00%> (+0.20%) ⬆️
Oplog Populator 85.83% <ø> (ø)
Replication 61.98% <ø> (-0.04%) ⬇️
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.5    #2794      +/-   ##
===================================================
- Coverage            75.50%   75.47%   -0.03%     
===================================================
  Files                  201      201              
  Lines                13928    13930       +2     
===================================================
- Hits                 10516    10514       -2     
- Misses                3402     3406       +4     
  Partials                10       10              
Flag Coverage Δ
api:retry 9.05% <0.00%> (-0.01%) ⬇️
api:routes 8.83% <0.00%> (-0.01%) ⬇️
bucket-scanner 85.76% <ø> (ø)
ft_test:queuepopulator 9.12% <0.00%> (-1.00%) ⬇️
ingestion 12.25% <0.00%> (-0.01%) ⬇️
lib 8.78% <0.00%> (-0.01%) ⬇️
lifecycle 19.24% <0.00%> (-0.01%) ⬇️
notification 1.00% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.13% <0.00%> (-0.01%) ⬇️
replication 18.80% <0.00%> (-0.01%) ⬇️
unit 54.71% <50.00%> (+0.05%) ⬆️

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 6, 2026
@bert-e

bert-e commented Aug 6, 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 August 6, 2026 08:49
@delthas
delthas force-pushed the improvement/BB-831/consumers-from-offset-earliest branch 4 times, most recently from 46741ad to e93986d Compare August 6, 2026 09:14
@delthas
delthas marked this pull request as ready for review August 6, 2026 09:16

@SylvainSenechal SylvainSenechal 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.

Approved but this looks again like quite a big oversight (maybe its mostly fixing issues with ci as if I understand correctly, 'earliest' will only apply to never commited partition which we have plenty in tests ci but probably not many in prod 🤔 )
You may wanna wait a few days for François to take a look though as he is back soon

Also, while its probably a bit annoying to do, I think this would really deserve a functional ci test in backbeat where we setup kafka, start a backbeat consumer then kill it and restart it, while manually producing a message in kafka in between, to make sure the behavior is correct 🤔

@delthas

delthas commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Agree this is mainly for CI, though this can happen when creating locations in production.

For functional tests we already have functional tests for earliest consumers added in #2488. Kill & restart wouldn't work as is because the partition offset would be kept and wouldn't restart from earliest.

@delthas

delthas commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Waiting for another reviewer :)

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

Nothing for me. It's clear enough.

But I have a weird feeling that I can't explain: like we did a fix but it's the right one, something else must be done. I don't know why, I don't know what. Maybe something when we create a location for example 🤷. Anyway, code looks right. For example:

  • backbeat-data-mover is one shared topic, but the group is ${groupId}-${this.site}, and every site filters by toLocation === this.site. Adding a location at runtime spawns a fresh QueueProcessor, hence a fresh group with no committed offsets — which under earliest now starts at offset 0 of the entire retained log.
  • extensions/notification/queueProcessor/QueueProcessor.js : Same. Group is ${groupId}-${destinationId}; when internalTopic is unset, all destinations share one topic. Adding a destination creates a new group on that old topic, and processKafkaEntry filters by destination ID, prefix, suffix, and event type — never by time. So the full retention window of a bucket's events gets delivered to the new destination as if fresh, breaking the S3 guarantee that only post-configuration events are notified.

Also this can have an impact on Ring, maybe better to check with them and asking for a review ?

Comment thread extensions/replication/queueProcessor/QueueProcessor.js Outdated
Comment thread extensions/lifecycle/objectProcessor/LifecycleObjectTransitionProcessor.js Outdated
Only the replication status consumer pinned fromOffset (BB-826); every other
BackbeatConsumer inherited librdkafka's default `latest`, so a message produced
onto a partition with no committed offset while the consumer group had no
member is skipped forever.

Pin `earliest` on the three consumers where that loss is permanent and the
group is not created per site or per destination: the lifecycle transition
tasks topic, the per-location cold status topics and the gc topic.

The lifecycle object (expiration) tasks topic, the data mover topic and the
notification internal topic deliberately stay on the default -- see BB-831 for
the per-consumer rationale and the replay-safety analysis behind each decision.

Extract the gc consumer options into _getConsumerOptions() for unit coverage,
following #2788.

Issue: BB-831
@delthas
delthas force-pushed the improvement/BB-831/consumers-from-offset-earliest branch from e93986d to 891f7af Compare August 7, 2026 14:12
@delthas

delthas commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks.

I'm dropping notification and data-mover from this PR to keep it low-risk. They're not affecting CI anyway (no notification issues in the Zenko run census, and no data-mover tests).

@delthas

delthas commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

So only backbeat-lifecycle-transition-tasks, cold-status-, gc remain. Those should be safe.

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