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

core/rawdb: no need to run truncateFile for readonly mode #28145

Merged
merged 3 commits into from
Sep 21, 2023

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Sep 18, 2023

If a file was opened in read-only mode, the file.Truncate will return the error: truncate xxx: invalid argument. Let's skip it.

Signed-off-by: jsvisa <delweng@gmail.com>
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

I am not sure this is correct behaviour. Perhaps we should still do the check(s), but instead of repairing errors we should return error?

@rjl493456442
Copy link
Member

Yeah, personally I think Martin's point is valuable. We should make sure the freezer is in valid status and report loudly if it's not. Otherwise, the corrupted freezer might return very weird errors when serving read operation.

Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
@jsvisa jsvisa requested a review from holiman September 19, 2023 13:40
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@holiman holiman added this to the 1.13.2 milestone Sep 21, 2023
@holiman holiman merged commit 545f4c5 into ethereum:master Sep 21, 2023
1 of 2 checks passed
tyler-smith pushed a commit to blocknative/go-ethereum that referenced this pull request Oct 12, 2023
…8145)

Avoid truncating files, if ancients are opened in readonly mode. With this change, we return error instead of trying (and failing)  to repair
tyler-smith pushed a commit to blocknative/go-ethereum that referenced this pull request Oct 12, 2023
…8145)

Avoid truncating files, if ancients are opened in readonly mode. With this change, we return error instead of trying (and failing)  to repair
siosw pushed a commit to fabriqnetwork/go-ethereum that referenced this pull request Oct 16, 2023
…8145)

Avoid truncating files, if ancients are opened in readonly mode. With this change, we return error instead of trying (and failing)  to repair
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
…8145)

Avoid truncating files, if ancients are opened in readonly mode. With this change, we return error instead of trying (and failing)  to repair
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Nov 29, 2023
…8145)

Avoid truncating files, if ancients are opened in readonly mode. With this change, we return error instead of trying (and failing)  to repair
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.

3 participants