-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: restore in-memory Manifest on write error #23552
Conversation
4e07537
to
8b6991c
Compare
Also improved test error messages per review comments
1049e60
to
1fc430d
Compare
tsdb/index/tsi1/partition.go
Outdated
if err != nil { | ||
// TODO: Close index if write fails. | ||
p.logger.Error("manifest file write failed compacting index", zap.String("path", p.ManifestPath()), zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p.logger
vs log
here - we should be consistent about which one to log with.
tsdb/index/tsi1/partition.go
Outdated
if err != nil { | ||
// TODO: Close index if write fails. | ||
p.logger.Error("manifest file write failed compacting index", zap.String("path", p.ManifestPath()), zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should always either return an error (with appropriate context for the caller) or log the error, but not both. Otherwise we end up logging errors at every level of the call stack.
We can avoid being religious about that for now if necessary, but any time we log an error and then return the error is a code smell for me.
tsdb/index/tsi1/partition.go
Outdated
if err != nil { | ||
// TODO: Close index if write fails. | ||
p.logger.Error("manifest file write failed compacting log file", zap.String("path", p.ManifestPath()), zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p.logger.Error here vs log.Error below.
Do not update the
FileSet
oractiveLogFile
field in the in-memoryPartition structure if the Manifest file is not correctly saved to
the disk.
closes #23553