This repository was archived by the owner on Mar 5, 2024. It is now read-only.
Open
Conversation
The main idea is to
1. asynchronously: enumerate all `{K, V}` pairs in the blocks CF;
2. in-parallel:
2.1 deserialize blocks;
2.2 lookup parents;
2.3 accumulate `{Parent, Child}` pairs;
3. in-serial:
3.1 build graph from above-built pairs;
3.2 walk backwards from the youngest given hash and trace its
longest possible lineage up to the oldest given hash.
The last step, 3.2, is essentially what the previous implementation
(that this one replaces) used to do, but this time all the expensive
deserialization has already been done, in parallel.
cb82d65 to
9bfd163
Compare
after moving from topsorting to trace-back - I realized that things are much simpler now - duh! Bonus - this is also about 30 seconds faster on my machine.
ff86a97 to
a3021f3
Compare
a3021f3 to
4a55a8d
Compare
7ddc188 to
3ca45ec
Compare
97fe3c3 to
ce26e25
Compare
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.
For a full chain resync, this reduces the
build_hash_chainrunning time from ~65 minutes to ~11 minutes on my machine (16-core Ryzen 9 with 32 GB RAM).Overview
High
The main idea is to unbundle the following bundled operations:
Mid
1.1. enumerate all
{K, V}pairs in the blocks CF2.1. consume above
{K, V}pairs2.2. deserialize blocks (the
Vs above)2.3. lookup parents
2.4. accumulate
{Child, Parent}pairs3.1. build a child-to-parent relations map from above pairs
3.2. walk the relations from the youngest given hash and trace its
longest possible lineage up to the oldest given hash
The last step, 3.2, is essentially what the previous, serial implementation used to do, but this time all the expensive deserialization has already been done, in parallel.
Low
See code :)