From 4fc8e35042655295e249b1e024f3cbd0beb97080 Mon Sep 17 00:00:00 2001 From: neriumpete Date: Thu, 25 Jun 2026 16:09:42 +0300 Subject: [PATCH 1/2] store: skip chains in pool_size = 0 shards instead of panicking at startup --- store/postgres/src/block_store.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/store/postgres/src/block_store.rs b/store/postgres/src/block_store.rs index 683553d7c22..1a627922ea8 100644 --- a/store/postgres/src/block_store.rs +++ b/store/postgres/src/block_store.rs @@ -275,6 +275,18 @@ impl BlockStore { .iter() .find(|chain| chain.name == chain_name) { + // A shard configured with `pool_size = 0` is intentionally + // ignored and has no connection pool. Skip chains that live in + // such a shard rather than failing startup. See issue #6195. + if !block_store.pools.contains_key(&chain.shard) { + warn!( + &block_store.logger, + "Skipping chain `{}`: its shard `{}` has no connection pool (pool_size = 0)", + chain.name, + chain.shard, + ); + continue; + } if chain.shard != shard { warn!( &block_store.logger, @@ -300,6 +312,17 @@ impl BlockStore { .iter() .filter(|chain| !configured_chains.contains(&chain.name)) { + // Skip chains whose shard has no connection pool (pool_size = 0) + // instead of failing startup. See issue #6195. + if !block_store.pools.contains_key(&chain.shard) { + warn!( + &block_store.logger, + "Skipping chain `{}`: its shard `{}` has no connection pool (pool_size = 0)", + chain.name, + chain.shard, + ); + continue; + } block_store.add_chain_store(chain, false).await?; } Ok(block_store) From 742964d20a9e8b7b90c5d4f8d2417c29c5a9b9f4 Mon Sep 17 00:00:00 2001 From: neriumpete Date: Sat, 27 Jun 2026 09:12:15 +0300 Subject: [PATCH 2/2] store: move pool_size = 0 filtering to existing_chains construction --- store/postgres/src/block_store.rs | 45 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/store/postgres/src/block_store.rs b/store/postgres/src/block_store.rs index 1a627922ea8..4bc9b105c57 100644 --- a/store/postgres/src/block_store.rs +++ b/store/postgres/src/block_store.rs @@ -253,7 +253,27 @@ impl BlockStore { const CHAIN_HEAD_CACHE_TTL: Duration = Duration::from_secs(2); let mirror = PrimaryMirror::new(&pools); - let existing_chains = mirror.read_async(primary::load_chains).await?; + // Treat a chain whose shard has no connection pool (i.e. a shard + // configured with `pool_size = 0`, which `store_builder` drops) as if it + // doesn't exist: skip it here so we neither create a chain store for it + // nor fail startup. See issue #6195. + let existing_chains: Vec<_> = mirror + .read_async(primary::load_chains) + .await? + .into_iter() + .filter(|chain| { + let has_pool = pools.contains_key(&chain.shard); + if !has_pool { + warn!( + &logger, + "Ignoring chain `{}`: its shard `{}` has no connection pool (pool_size = 0)", + chain.name, + chain.shard, + ); + } + has_pool + }) + .collect(); let chain_head_cache = TimedCache::new(CHAIN_HEAD_CACHE_TTL); let chains = shards.clone(); @@ -275,18 +295,6 @@ impl BlockStore { .iter() .find(|chain| chain.name == chain_name) { - // A shard configured with `pool_size = 0` is intentionally - // ignored and has no connection pool. Skip chains that live in - // such a shard rather than failing startup. See issue #6195. - if !block_store.pools.contains_key(&chain.shard) { - warn!( - &block_store.logger, - "Skipping chain `{}`: its shard `{}` has no connection pool (pool_size = 0)", - chain.name, - chain.shard, - ); - continue; - } if chain.shard != shard { warn!( &block_store.logger, @@ -312,17 +320,6 @@ impl BlockStore { .iter() .filter(|chain| !configured_chains.contains(&chain.name)) { - // Skip chains whose shard has no connection pool (pool_size = 0) - // instead of failing startup. See issue #6195. - if !block_store.pools.contains_key(&chain.shard) { - warn!( - &block_store.logger, - "Skipping chain `{}`: its shard `{}` has no connection pool (pool_size = 0)", - chain.name, - chain.shard, - ); - continue; - } block_store.add_chain_store(chain, false).await?; } Ok(block_store)