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: fix db commands #24540

Merged
merged 1 commit into from
Mar 22, 2022
Merged

core/rawdb: fix db commands #24540

merged 1 commit into from
Mar 22, 2022

Conversation

rjl493456442
Copy link
Member

@rjl493456442 rjl493456442 commented Mar 15, 2022

This PR adds a hack to freezer, the newly introduced meta data file will always be opened in the read/write mode.

The reason for adding this hack is: the meta data files are missing for legacy nodes which means most of the db commands will fail when the db is opened in the read-only mode.

Since tail deletion is not used right now, the only mutation can be made is initialization which is acceptable instead of breaking existent commands.

// will suddenly break lots of database relevant commands. So the metadata file
// is always opened for mutation and nothing else will be written except
// the initialization.
meta, err = openFreezerFileForAppend(filepath.Join(path, fmt.Sprintf("%s.meta", name)))
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it easier to just check os.IsNotExist(err) and ignore it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case, the meta file handler is nil and we need to check if the handler is nil afterward.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the hack is acceptable

@holiman holiman merged commit 6afb717 into ethereum:master Mar 22, 2022
@holiman holiman added this to the 1.10.17 milestone Mar 22, 2022
sidhujag pushed a commit to syscoin/go-ethereum that referenced this pull request Mar 23, 2022
JacekGlen pushed a commit to JacekGlen/go-ethereum that referenced this pull request May 26, 2022
cp-wjhan pushed a commit to cp-yoonjin/go-wemix that referenced this pull request Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants