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/state/pruner: fix compaction after pruning #22291

Merged
merged 1 commit into from
Feb 8, 2021

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Feb 8, 2021

I split up the compactor to have periodic progress reports, but unfortunately I messed it up and instead of having ranges of 0x0 to 0x1, 0x1 to 0x2 I had 0x00 to 0x01 and 0x01 to 0x02. Thus I only compacted 1/16th of the entire range. This PR solves it by shifting the prefix byte to the high bits.

@karalabe karalabe added this to the 1.10.0 milestone Feb 8, 2021
@karalabe karalabe merged commit 944d901 into ethereum:master Feb 8, 2021
if err := maindb.Compact([]byte{b}, []byte{b + 1}); err != nil {
var (
start = []byte{b << 4}
end = []byte{(b+1)<<4 - 1}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is correct either. You'll have e.g. start 0x40 and end 0x4f. But the end is the limit in the leveldb range, which is exclusive.

I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

Bleah, you're right.

	// Limit of the key range, not include in the range.
	Limit []byte

Myeah, wanna fix it? :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure

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