From 9a51f3b7065ed4854208f3519b721a56ac35413d Mon Sep 17 00:00:00 2001 From: encalypto Date: Wed, 28 Aug 2024 13:13:58 -0400 Subject: [PATCH] Use correct store when loading indexes for graft base (#5616) Previously, we were trying to load indexes from the store corresponding to the subgraph being deployed. This was the wrong shard, resulting in deployment failures when a subgraph is on a different shard from its graft based. This updates the call to use the correct store. --- store/postgres/src/subgraph_store.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/store/postgres/src/subgraph_store.rs b/store/postgres/src/subgraph_store.rs index 7216dc993b5..41cbef15982 100644 --- a/store/postgres/src/subgraph_store.rs +++ b/store/postgres/src/subgraph_store.rs @@ -579,7 +579,12 @@ impl SubgraphStoreInner { let index_def = if let Some(graft) = &graft_base.clone() { if let Some(site) = self.sites.get(graft) { - Some(deployment_store.load_indexes(site)?) + let store = self + .stores + .get(&site.shard) + .ok_or_else(|| StoreError::UnknownShard(site.shard.to_string()))?; + + Some(store.load_indexes(site)?) } else { None }