-
Notifications
You must be signed in to change notification settings - Fork 180
fix(f3): avoid closing leveldb twice #6144
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
Conversation
WalkthroughAdjusted datastore cleanup: instead of deferring close on the raw datastore, the code now keeps it open, wraps it in a dsWrapper, and defers closing the wrapper with error-joining on close. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Caller
participant Import as import.go
participant DS as Datastore (raw)
participant W as dsWrapper
C->>Import: import(...)
activate Import
Import->>DS: Open/obtain raw datastore
Note right of DS: Raw datastore remains open
Import->>W: Create dsWrapper(DS)
Note over Import,W: Defer W.Close with error-joining
Import-->>C: Perform import operations using W
deactivate Import
C->>Import: function returns (deferred runs)
Import->>W: Close()
alt Close returns error
Note right of W: Error joined into return error
else Close succeeds
Note right of W: No additional error
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
Comment |
return err | ||
} | ||
defer func() { | ||
if closeErr := ds.Close(); closeErr != 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.
dsWrapper.Close
calls ds.Close
internally
Summary of changes
To fix below error (which does not break anything)
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Summary by CodeRabbit