refactor: Open file in FileCommit#28006
Closed
maflcko wants to merge 3 commits intobitcoin:masterfrom
Closed
Conversation
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
fa9350f to
624ba04
Compare
Member
Author
|
Closing for now, until there is a higher need for it. |
Member
Author
|
Looks like this will make it safer to remove |
Contributor
|
🐙 This pull request conflicts with the target branch and needs rebase. |
added 3 commits
July 20, 2023 20:12
This is needed for a future commit.
This allows to remove platform-specific code and avoids it being maintained in this codebase. This is a refactor, apart from potentially using one more file descriptor at runtime, due to the same file being opened already earlier. However, the increase in file descriptors will be undone in the next commit.
* This removes the requirement from the call site to use a raw C-style FILE pointer. Now the call site can use any style of file IO. * This makes the edge-case impossible to call FileCommit with nullptr, which would eventually lead to a segfault. * This removes the burden from the call site to first open the file. * This avoids a fseek if the file was opened using FlatFileSeq::Open with a non-zero nPos. * Where the file was already open at a call site, it removes the burden to keep it open for FileCommit. Call sites are now expected to close or flush the file before calling FileCommit. * This removes the requirement from the call site to open the file with the right mode (write). This should be a refactor, because the following corner cases never happen: * FlatFileSeq::Open has a side-effect to create the file when it is missing. Thus, in WriteFilterToDisk, if the first filter overflew the first file, the node would abort. Previously it would create an empty first filter file.
Member
Author
|
Closing for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This improves
FileCommit: The patch removes the requirement from the call site to open or obtain a raw C-style FILE pointer. Now the call site can use any style of file IO.There are many other smaller improvements, which are explained in each commit.