Skip to content

Commit 80aa2b0

Browse files
authored
Revert "delete 'shallow blocks' in block cache when not using firehose (#4691)" (#4752)
* Revert "delete 'shallow blocks' in block cache when not using firehose (#4691)" This reverts commit f7fec01. * store: Restore migration for shallow blocks index
1 parent c9280f1 commit 80aa2b0

File tree

3 files changed

+1
-47
lines changed

3 files changed

+1
-47
lines changed

node/src/main.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -378,16 +378,6 @@ async fn main() {
378378
Some(&eth_firehose_only_networks)
379379
};
380380

381-
let eth_firehose_only_network_names = match eth_firehose_only_networks {
382-
Some(firehose_only) => Some(Vec::from_iter(firehose_only.networks.keys())),
383-
None => None,
384-
};
385-
386-
network_store
387-
.block_store()
388-
.cleanup_shallow_blocks(eth_firehose_only_network_names)
389-
.unwrap();
390-
391381
let ethereum_chains = ethereum_networks_as_chains(
392382
&mut blockchain_map,
393383
&logger,

store/postgres/src/block_store.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::{
77
use graph::{
88
blockchain::ChainIdentifier,
99
components::store::BlockStore as BlockStoreTrait,
10-
prelude::{error, info, warn, BlockNumber, BlockPtr, Logger, ENV_VARS},
10+
prelude::{error, warn, BlockNumber, BlockPtr, Logger, ENV_VARS},
1111
};
1212
use graph::{constraint_violation, prelude::CheapClone};
1313
use graph::{
@@ -442,23 +442,6 @@ impl BlockStore {
442442
Ok(())
443443
}
444444

445-
pub fn cleanup_shallow_blocks(
446-
&self,
447-
firehose_networks: Option<Vec<&String>>,
448-
) -> Result<(), StoreError> {
449-
for store in self.stores.read().unwrap().values() {
450-
if let Some(fh_nets) = firehose_networks.clone() {
451-
if fh_nets.contains(&&store.chain) {
452-
continue;
453-
};
454-
}
455-
456-
info!(&self.logger, "Cleaning shallow blocks on non-firehose chain"; "network" => &store.chain);
457-
store.cleanup_shallow_blocks()?
458-
}
459-
Ok(())
460-
}
461-
462445
fn truncate_block_caches(&self) -> Result<(), StoreError> {
463446
for store in self.stores.read().unwrap().values() {
464447
store.truncate_block_cache()?

store/postgres/src/chain_store.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ mod data {
346346
data jsonb not null
347347
);
348348
create index blocks_number ON {nsp}.blocks using btree(number);
349-
create index blocks_expr_idx ON {nsp}.blocks USING BTREE ((data->'block'->'data')) where data->'block'->'data' = 'null'::jsonb;
350349
351350
create table {nsp}.call_cache (
352351
id bytea not null primary key,
@@ -419,18 +418,6 @@ mod data {
419418
Ok(())
420419
}
421420

422-
pub(super) fn cleanup_shallow_blocks(&self, conn: &PgConnection) -> Result<(), StoreError> {
423-
let table_name = match &self {
424-
Storage::Shared => ETHEREUM_BLOCKS_TABLE_NAME,
425-
Storage::Private(Schema { blocks, .. }) => &blocks.qname,
426-
};
427-
conn.batch_execute(&format!(
428-
"delete from {} WHERE data->'block'->'data' = 'null'::jsonb;",
429-
table_name
430-
))?;
431-
Ok(())
432-
}
433-
434421
/// Insert a block. If the table already contains a block with the
435422
/// same hash, then overwrite that block since it may be adding
436423
/// transaction receipts. If `overwrite` is `true`, overwrite a
@@ -1566,12 +1553,6 @@ impl ChainStore {
15661553
.delete_blocks_by_hash(&conn, &self.chain, block_hashes)
15671554
}
15681555

1569-
pub fn cleanup_shallow_blocks(&self) -> Result<(), StoreError> {
1570-
let conn = self.get_conn()?;
1571-
self.storage.cleanup_shallow_blocks(&conn)?;
1572-
Ok(())
1573-
}
1574-
15751556
pub fn truncate_block_cache(&self) -> Result<(), StoreError> {
15761557
let conn = self.get_conn()?;
15771558
self.storage.truncate_block_cache(&conn)?;

0 commit comments

Comments
 (0)