Skip to content
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

Merged
merged 64 commits into from
Jun 12, 2024
Merged

e3: Appendable type #10687

merged 64 commits into from
Jun 12, 2024

Conversation

AskAlexSharov
Copy link
Collaborator

No description provided.

@AskAlexSharov AskAlexSharov requested a review from awskii June 10, 2024 04:55
if out == nil {
panic("must not happen: " + ap.filenameBase)
}
ap.dirtyFiles.Delete(out)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need close out here

Copy link
Collaborator Author

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.

@awskii awskii merged commit 17f8d08 into main Jun 12, 2024
10 checks passed
@awskii awskii deleted the appendable_type branch June 12, 2024 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants