store: skip chains in pool_size = 0 shards instead of panicking at startup (#6195)#6648
Open
cargopete wants to merge 1 commit into
Open
store: skip chains in pool_size = 0 shards instead of panicking at startup (#6195)#6648cargopete wants to merge 1 commit into
cargopete wants to merge 1 commit into
Conversation
lutter
requested changes
Jun 25, 2026
lutter
left a comment
Collaborator
There was a problem hiding this comment.
Nice, just one small cleanup
| chain.shard, | ||
| ); | ||
| continue; | ||
| } |
Collaborator
There was a problem hiding this comment.
It would be better to do this filtering when we construct existing_chains rather than every time we iterate over it - essentially, this logic treats a chain with pool_size == 0 as not exsiting/configured.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #6195. A node configured with
pool_size = 0for an unused shard (adocumented option from #3513) panics on startup:
store_buildercorrectly dropspool_size = 0shards from the pool map, butDieselBlockStore::newthen iterates every chain — both configured chainsand all chains present in the database — and calls
add_chain_storefor each.add_chain_storeerrors when a chain's shard has no pool, and that error is.expect()ed instore_builder, killing startup. Sopool_size = 0is onlyhalf-implemented: the pool is skipped, but the chains living in that shard are
not.
Fix
In both chain-enumeration loops in
DieselBlockStore::new, skip chains whoseshard has no connection pool (logging a
WARN) instead of callingadd_chain_store. This lets a node list all shards inconfig.tomlbut onlyconsume Postgres connections for the shards it actually uses, which is the
intent of
pool_size = 0.add_chain_store's contract is unchanged — it still errors when creating anew chain in a shard with no pool, which remains a genuine misconfiguration.
Testing
cargo fmt,cargo clippy --all-targets, andcargo check --releasecleanfor
graph-store-postgres.I was not able to add an automated test:
DieselBlockStore::newandConnectionPoolrequire a live multi-shard Postgres, so exercising themulti-shard startup path isn't possible in a unit test. The change is small and
verified by inspection, but I'd appreciate a maintainer (or @0x19dG87) confirming
startup against a real multi-shard config with
pool_size = 0set on an unusedshard.