-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
e3: Appendable type #10687
e3: Appendable type #10687
Conversation
erigon-lib/state/merge.go
Outdated
if out == nil { | ||
panic("must not happen: " + ap.filenameBase) | ||
} | ||
ap.dirtyFiles.Delete(out) |
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.
need close out
here
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.
no. can't just close file - even if you just merged it.
because there is still can be alive readers (which see/read this file). Example of "reader": RPCDaemon's roTx
.
amount of readers can get by out.refcount.Load()
.
so, the right handling of merged files must be:
// if merged file not visible for any alive reader (even for us): can remove it immediately
// otherwise: mark it as `canDelete=true` and last reader of this file - will remove it inside `aggRoTx.Close()`
if out.refcount.Load() == 0 {
out.closeFilesAndRemove()
} else {
out.canDelete.Store(true)
}
created helper func for it. and used everywhere.
No description provided.