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

ignore --shard-stores if --compact is present #660

Merged
merged 2 commits into from
Jan 28, 2024

Conversation

cldellow
Copy link
Contributor

Fixes #657

These two settings are incompatible, because CompactNodeStore does not implement .contains(...)

Instead, if --compact is present, don't shard stores. Further, throw if code calls .contains(...), so that we'll fail noisily and more clearly.

I debated teaching CompactNodeStore how to do .contains(...), e.g. by maintaning a bitmap of which entries were present. Ultimately, though, I think sharding CompactNodeStores does not make sense -- each CompactNodeStore instance will use about the same amount of memory (vs the other stores, which will each use 1/N memory)

Also a small tweak: detect if --compact is used on a non-renumbered PBF, and warn the user.

A future commit will make it safe to do so, but it's still
memory-inefficient to use --compact on a non-renumbered PBF
CompactNodeStore doesn't know how to compute if it contains a node,
which is a prerequisite for sharding.

The two settings don't make much sense together: sharding will create N
CompactNodeStores, which each will take as much memory as a single one,
since each will likely have a large node ID.

This differs from BinarySearchNodeStore and SortedNodeStore, where each of
the N store instances will take roughly 1/N memory.

Instead:

- fail faster and more clearly by throwing if CompactNodeStore.contains is
  called
- don't enable sharding if --compact is passed
@systemed systemed merged commit 1c8ad9d into systemed:master Jan 28, 2024
5 checks passed
@systemed
Copy link
Owner

Thanks! Yes, that makes sense.

Using std::exchange on a bool is a clever little idiom - never seen that before :)

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.

"Could not find node with id" despite node presence in PBF
2 participants