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

Deprecate heapsize #14

Merged
merged 13 commits into from
Jun 11, 2019
Merged

Deprecate heapsize #14

merged 13 commits into from
Jun 11, 2019

Conversation

cheme
Copy link
Contributor

@cheme cheme commented Feb 27, 2019

This PR deprecates heapsize (currently keeping it behind an optional feature).
It uses parity-util-mem instead.
This PR can be reviewed but cannot merge until PR paritytech/parity-common#93 paritytech/parity-common#94 get approved and the crate published.
The versioning was not yet updated.

memory-db/src/lib.rs Outdated Show resolved Hide resolved
memory-db/Cargo.toml Outdated Show resolved Hide resolved
memory-db/src/lib.rs Outdated Show resolved Hide resolved
@cheme
Copy link
Contributor Author

cheme commented Jun 3, 2019

@dvdplm I went into a full crate upgrade (memorydb being use by hashdb and hashdb by triedb we end up in a situation where it is needed to get everything same version (and iirc it was a consensus we keep all those crate versioned identically).

memory-db/Cargo.toml Outdated Show resolved Hide resolved
@dvdplm
Copy link
Contributor

dvdplm commented Jun 3, 2019

@bkchr can you take a look at this please? :)

@dvdplm dvdplm requested review from ordian and dvdplm June 7, 2019 13:35
pub static EMPTY_PREFIX: Prefix<'static> = &[];

/// Prefix byte information for avoding rc.
pub type Prefix<'a> = &'a[u8];
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you help me understand what this does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is an additional information that can be use to ensure key uniqueness in the hashdb.
Basically we do not reference count the key value; if some different nodes in the trie contains the same content a pruning conflict will occur.
For ethereum, the constructed keys are long and unique enough so that leaf contains a part of the key big enough to ensure that it is hash is unique and no rc is needed (intermediatory node containing those leaf hash that is also the case). This really depends on the way keys are build.

In substrate where the use cases are more open, there was this pruning issue, solution there was to add the path in the trie to the info (unique by nature of the trie), we did not have to use reference count.
There trie issue with the merged pr contains more info (I did not understand directly so I asked my questions there).
So for parity ethereum, this is strictly overhead, note that with my trie pr about removal of extension, this overhead gets a bit reduced (there is also an interesting scheme that add the prefix in an ordered encoding to try to allow iteration directly from rocksdb but I do not know if it is worth the overhead (unless the state is totally pruned that does not allow state iteration still can be use for some analysis)).

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

LGTM

@ordian ordian merged commit 8dd6872 into paritytech:master Jun 11, 2019
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.

4 participants