Skip to content

Retry the setup of an ingestion reader when it fails - #2806

Open
benzekrimaha wants to merge 1 commit into
development/9.5from
improvement/BB-846-retry-ingestion-reader-setup
Open

Retry the setup of an ingestion reader when it fails#2806
benzekrimaha wants to merge 1 commit into
development/9.5from
improvement/BB-846-retry-ingestion-reader-setup

Conversation

@benzekrimaha

Copy link
Copy Markdown
Contributor

When a reader's setup fails (typically the getRaftId call to the source), it was dropped from the pending list and never set up again: the reader stays registered in _ingestionSources, so applyUpdates considers the bucket already handled and only refreshes it. The bucket was therefore left out of ingestion until the pod was restarted.

Queue the reader again instead, so it is retried on the next cycle. This follows what _processLogReaderEntries already does with read failures, and keeps the other locations ingesting, which restarting the pod on a failed healthcheck would not.

The reader is only queued again if its source is still configured, as it may have been removed while its setup was in progress.

Issue: BB-846

@bert-e

bert-e commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Hello benzekrimaha,

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.80%. Comparing base (225a8a3) to head (2f9c7f5).

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
lib/queuePopulator/IngestionPopulator.js 69.76% <100.00%> (+2.65%) ⬆️

... and 2 files with indirect coverage changes

Components Coverage Δ
Bucket Notification 80.27% <ø> (ø)
Core Library 82.04% <100.00%> (+0.09%) ⬆️
Ingestion 70.79% <100.00%> (+0.69%) ⬆️
Lifecycle 80.46% <ø> (ø)
Oplog Populator 85.83% <ø> (ø)
Replication 62.01% <ø> (-0.04%) ⬇️
Bucket Scanner 85.76% <ø> (ø)
@@                 Coverage Diff                 @@
##           development/9.5    #2806      +/-   ##
===================================================
+ Coverage            75.77%   75.80%   +0.03%     
===================================================
  Files                  200      200              
  Lines                13922    13925       +3     
===================================================
+ Hits                 10549    10556       +7     
+ Misses                3363     3359       -4     
  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 11.00% <0.00%> (-0.04%) ⬇️
ingestion 12.26% <0.00%> (-0.01%) ⬇️
lifecycle 19.30% <0.00%> (-0.02%) ⬇️
notification 1.02% <0.00%> (-0.01%) ⬇️
oplogPopulator 0.13% <0.00%> (-0.01%) ⬇️
replication 18.84% <0.00%> (-0.01%) ⬇️
unit 54.95% <100.00%> (+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.

@bert-e

bert-e commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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 Aug 18, 2026
@scality scality deleted a comment from bert-e Aug 18, 2026
@benzekrimaha
benzekrimaha force-pushed the improvement/BB-846-retry-ingestion-reader-setup branch from 5ad48bb to bd6999f Compare August 19, 2026 13:20
@benzekrimaha
benzekrimaha marked this pull request as ready for review August 19, 2026 17:21
@benzekrimaha
benzekrimaha requested review from a team, delthas and francoisferrand August 19, 2026 17:21
error: err,
});
// the source may have been removed from the configuration
// while its setup was in progress

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.

this comment is misleading: it is not that it "may have been removed", it is certain that is was removed c.f. the beginning of the function:

        const newReaders = this.logReadersUpdate;
        this.logReadersUpdate = [];

→ here you want to explain why you re-add it

Suggested change
// while its setup was in progress
// Setup failures are usually transient (source unreachable,
// invalid credentials...): queue the reader again so that it
// is retried on the next cycle

@benzekrimaha benzekrimaha Aug 20, 2026

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.

Reworded to say why the reader is queued again.

One precision : that comment was about _ingestionSources, the registry of configured sources, not about logReadersUpdate which the function drains at the top. Those are two different structures, and the guard reads the former.
It was imprecise for another reason though. _closeLogState only deletes the _ingestionSources entry when it finds the reader in logReadersUpdate or in logReaders, and while its setup is in progress the reader is in neither, so a source removed right then still leaves its entry behind. What the guard actually catches is a reader that is no longer the one registered for its bucket, which is what the new comment says.

Comment on lines +621 to +625
// Setup failures are usually transient (source unreachable,
// invalid credentials...). Queue the reader again so that it
// is retried on the next cycle: `applyUpdates` only refreshes
// sources that are already registered, so a reader dropped
// here would never be set up again.

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 relevant to the code: the old comment was -and still is- correct, we don't add this one to logReaders and continue setting up others...

Suggested change
// Setup failures are usually transient (source unreachable,
// invalid credentials...). Queue the reader again so that it
// is retried on the next cycle: `applyUpdates` only refreshes
// sources that are already registered, so a reader dropped
// here would never be set up again.
// if setup fails for a log reader, don't add it to `logReaders`
// log the error and continue setting up others

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.

Restored.

Comment on lines +626 to +629
const zenkoBucket = logReader.getTargetZenkoBucketName();
this.log.error('error setting up log reader, retrying later', {
method: 'IngestionPopulator._setupUpdatedReaders',
zenkoBucket,

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.

I think we should log the location instead of the bucket, seems more appropriate - or in addition to the bucket, for consistency with other logs in this file:

Suggested change
const zenkoBucket = logReader.getTargetZenkoBucketName();
this.log.error('error setting up log reader, retrying later', {
method: 'IngestionPopulator._setupUpdatedReaders',
zenkoBucket,
this.log.error('error setting up log reader, retrying later', {
method: 'IngestionPopulator._setupUpdatedReaders',)
zenkoBucket: logReader.getTargetZenkoBucketName(),
location: logReader.getLocationConstraint(),

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.

Done, location sits next to zenkoBucket now. I kept the zenkoBucket const since the guard right below reads it.

@bert-e

bert-e commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

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

  • 8.6.58

  • 9.0.31

  • 9.1.13

  • 9.2.8

  • 9.3.8

  • 9.4.4

  • 9.5.0

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

  • 8.6.58

  • 9.0.31

  • 9.1.13

  • 9.2.8

  • 9.3.8

  • 9.4.4

  • 9.5.1

  • 9.6.0

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

@francoisferrand

francoisferrand commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

not the right target branch: no point fixing so far back in time: from 9.5 is enough
(also this is not an improvement, but a bug. so branch name is not right)

@benzekrimaha
benzekrimaha changed the base branch from development/8.6 to development/9.5 August 20, 2026 13:05
@bert-e

bert-e commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Branches have diverged

This pull request's source branch improvement/BB-846-retry-ingestion-reader-setup has diverged from
development/9.5 by more than 50 commits.

To avoid any integration risks, please re-synchronize them using one of the
following solutions:

  • Merge origin/development/9.5 into improvement/BB-846-retry-ingestion-reader-setup
  • Rebase improvement/BB-846-retry-ingestion-reader-setup onto origin/development/9.5

Note: If you choose to rebase, you may have to ask me to rebuild
integration branches using the reset command.

When a reader's setup fails (typically the getRaftId call to the source),
it was dropped from the pending list and never set up again: the reader
stays registered in _ingestionSources, so applyUpdates considers the
bucket already handled and only refreshes it. The bucket was therefore
left out of ingestion until the pod was restarted.

Queue the reader again instead, so it is retried on the next cycle. This
follows what _processLogReaderEntries already does with read failures,
and keeps the other locations ingesting, which restarting the pod on a
failed healthcheck would not.

The reader is only queued again if it is still the one registered for
its bucket, so a source removed or replaced in the meantime is not
brought back.

Issue: BB-846
@benzekrimaha
benzekrimaha force-pushed the improvement/BB-846-retry-ingestion-reader-setup branch from bd6999f to 2f9c7f5 Compare August 20, 2026 13:15
@bert-e

bert-e commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

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

  • 8.6.58

  • 9.0.31

  • 9.1.13

  • 9.2.8

  • 9.3.8

  • 9.4.4

  • 9.5.0

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

  • 9.5.1

  • 9.6.0

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

@benzekrimaha

Copy link
Copy Markdown
Contributor Author

Retargeted to development/9.5 and rebased on it, so the diverged-branch warning is gone.

On the branch prefix: BB-846 is already typed Bug in Jira, only the branch name says otherwise. Renaming it means closing this PR and opening a new one, which also moves the base of #2821 stacked on top, so I left the branch name as is.

@bert-e

bert-e commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

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 Aug 20, 2026
@francoisferrand

Copy link
Copy Markdown
Contributor

What happens when the location is deleted?

Please confirm there no risk of path or race condition where we would keep retrying to setup a location which was removed...

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