-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[extension/storage/filestorage] Fix recreate
from panic
#41802
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
base: main
Are you sure you want to change the base?
[extension/storage/filestorage] Fix recreate
from panic
#41802
Conversation
Changes the `Recreate` option's behavior in file storage to act as a panic recovery mechanism. Previously, `Recreate` would unconditionally rename the database file upon startup if enabled. Now, when `Recreate` is true, it only renames the existing database file to a `.backup` and creates a new one if an attempt to open the database results in a panic, typically due to corruption. This improvement allows for automatic recovery from corrupted database files, preventing data loss in most cases, and ensures that healthy databases are not unnecessarily recreated.
/label waiting-for-code-owners |
…x' into file-extension-panic-recovery-fix
zap.Any("panic", r)) | ||
|
||
// Rename the corrupted file | ||
backupName := absoluteName + ".backup" |
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.
What if the backup file already exists? Can we use a snapshot of current time instead?
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.
@atoulme I'll be completely transparent and share that the goal of this PR is to further enhance the existing logic introduced in 0.131.0, and to prevent data loss on restarts.
It's not something that has been taken into consideration as a part of this change, but am assuming that the codeowners were okay with the previous implementation.
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.
@VihasMakwana wdyt
Description
recreate
behavior to not rename the file upon every start of the collector.Link to tracking issue
Resolves #36840
Resolves #35899
Testing
Documentation
Updated the existing documentation with behavioral changes for
recreate
option.