fix(tsdb): Do not try to ship TSDBs that cannot be opened upon start#21769
Merged
fix(tsdb): Do not try to ship TSDBs that cannot be opened upon start#21769
Conversation
On TSDB shipper start the manager tries to load all local TSDB files and hand them to the shipper, which eventually uploads them to object storage. This change fixes a bug that causes a nil pointer dereference when a TSDB file fails to open but is nevertheless added to the shipper.
ashwanthgoli
reviewed
May 6, 2026
| multiErr.Add(err) | ||
| loadingErrors++ | ||
| return err | ||
| continue |
Contributor
There was a problem hiding this comment.
this is a change of behavior, should we treat both loading and adding to index failures are errors and fail the start-up?
Contributor
Author
There was a problem hiding this comment.
Not it does not return on first error, but continues the operation with the remaining TSDBs. However, the error is still returned at the end.
Contributor
There was a problem hiding this comment.
is there a need to load more TSDBs if we are going to fail the service anyway?
Contributor
Author
There was a problem hiding this comment.
At least we should try IMO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On TSDB shipper start the manager tries to load all local TSDB files and hand them to the shipper, which eventually uploads them to object storage.
This change fixes a bug that causes a nil pointer dereference when a TSDB file fails to open but is nevertheless added to the shipper.
What this PR does / why we need it:
Closes #9297
Note
Medium Risk
Changes TSDB shipper startup behavior to continue on per-file failures and return an aggregated error, which could alter failure visibility and startup success conditions.
Overview
On
tsdbManager.Start, failures to open local TSDB files no longer cause partially-initialized indices to be handed to the shipper; broken TSDBs are skipped and a clearer warning is logged.Startup now accumulates load/add errors via
multierrorand continues scanning remaining TSDBs, returning the aggregated error at the end (and reporting it in the final "loaded leftover local indices" log).Reviewed by Cursor Bugbot for commit 59f718c. Bugbot is set up for automated code reviews on this repo. Configure here.