-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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(defrag): handle no space left error #18822
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Thomas Gosteli <[email protected]>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ghouscht The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @ghouscht. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files
... and 22 files with indirect coverage changes @@ Coverage Diff @@
## main #18822 +/- ##
==========================================
+ Coverage 68.76% 68.80% +0.04%
==========================================
Files 420 420
Lines 35523 35526 +3
==========================================
+ Hits 24426 24445 +19
+ Misses 9665 9660 -5
+ Partials 1432 1421 -11 Continue to review full report in Codecov by Sentry.
|
The e2e test looks good. The proposed solution is to restore the environment (i.e. reopen the bbolt) when defragmentation somehow fails and panicking if the restoring fails again. If the bbols fails to be opened, then etcdserver can't serve any requests, so it makes sense to panic it. cc @fuweid @ivanvc @jmhbnz @serathius @tjungblu |
Signed-off-by: Thomas Gosteli <[email protected]>
I added a second commit that contains a working implementation of a possible restore operation. I did some manual testing with the failpoint and the e2e test and it seems to work. However this opens up a whole lot of other possible problems. I highlighted some of them with |
server/storage/backend/backend.go
Outdated
@@ -455,7 +456,61 @@ func (b *backend) Commits() int64 { | |||
} | |||
|
|||
func (b *backend) Defrag() error { | |||
return b.defrag() | |||
err := b.defrag() | |||
if err != nil { |
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.
Instead of doing the restore here we could probably place it inside a defer
in defrag()
function? However, if we do so we need to be a bit careful about releasing the locks -> order of defered function execution is important in that case.
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.
Not sure why do generic error handling here.
Why not identify where b.defrag()
generates error and then improve error handler there?
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.
Sure that is an option, I just thought you're looking for a generic error handling.
I already know where the error happens so we can improve that. I'll add another commit.
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.
Added 1fb2064 which addresses your comment and only handles the specific error. The e2e test is adapted as well. Manual testing and the e2e test seem to confirm that this is working.
Please let me know if this is OK and how to continue.
// Commit/stop and then reset current transactions (including the readTx) | ||
b.batchTx.unsafeCommit(true) | ||
b.batchTx.tx = nil |
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.
Moving this down here ensures that no special error handling is needed in case os.CreateTemp
fails
Signed-off-by: Thomas Gosteli <[email protected]>
PR contains an e2e test, gofailpoint and a fix for the issue described in #18810.
Without the fix the test triggers a nil ptr panic in etcd as described in the linked issue:
I think from here on we can discuss potential solutions for the problem. @ahrtr already suggested two possible options in the linked issue.As mentioned in #18822 (comment) the PR now restores the environment and lets etcd continue to run.
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.