Added utility to dump ledger state from buckets to JSON #3447
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.
Description
Added utility to dump ledger state from buckets to JSON for debugging (optionally using
jq
for post-processing).The full ledger in this format currently takes ~19GB and is not really feasible for meaningful processing. Hence initially I introduce the following ways to reduce the output (all of which can be combined):
For the sake of filtering I introduced XDR field extraction utility, that can be used for other dynamic operations on XDR, e.g. group-by and/or reduction. However, for now I'm keeping this minimalistic until some concrete use-cases that aren't feasible with the current approach appear.
The current approach is a simple iteration over buckets from newer to older. This probably could be optimized (e.g. with parallel execution or XDR of intermediate results), but for now the performance seems acceptable: ~80s on my laptop for filtering the full ledger with a reasonably small output set.
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)