-
Notifications
You must be signed in to change notification settings - Fork 655
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
Change error handling logic in db.close() #400
Change error handling logic in db.close() #400
Conversation
db.go
Outdated
@@ -649,9 +650,10 @@ func (db *DB) close() error { | |||
// Clear ops. | |||
db.ops.writeAt = nil | |||
|
|||
var errs []string |
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.
var errs []string | |
var errs []error |
I suggest to only return the first error if present. It is consistent with the existing behavior. We will add log in separate PR to record all errors.
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.
Please resolve this comment: change the type to []error
. It doesn't make sense to convert the errors to strings, and finally convert them back to errors.
Please signoff the commit:
|
fa761d2
to
dddc5fd
Compare
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.
LGTM
Thank you @CaojiamingAlan
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.
Please resolve the workflow error.
…or in the middle Signed-off-by: caojiamingalan <alan.c.19971111@gmail.com>
dddc5fd
to
ef81032
Compare
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.
Thank you. Looks good to me. Let's see whether the test passes.
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.
Thanks again.
Could you backport this PR to release-1.3?
#382 (comment)
Complete all cleanup operations in db.close() even if there is an error in the middle. Otherwise fd remains open and flock is not released.
Add a test mocking the munmap syscall fails. This test fails before this commit.