Skip to content

Commit d13f710

Browse files
committed
graph: Add GRAPH_STORE_IGNORE_BLOCK_CACHE env var
Add a boolean env var that, when set, will cause block reads for blocks outside the per-chain cache_size window to behave as if the data field is null. This is the first step toward experimenting with reduced block caching before the full block cache revamp.
1 parent 9bf36c7 commit d13f710

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

graph/src/env/store.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ pub struct EnvVarsStore {
145145
pub use_brin_for_all_query_types: bool,
146146
/// Temporary env var to disable certain lookups in the chain store
147147
pub disable_block_cache_for_lookup: bool,
148+
/// When set, block reads for blocks that are more than `cache_size`
149+
/// blocks behind the chain head will act as if the data field in
150+
/// the database was null. Set by `GRAPH_STORE_IGNORE_BLOCK_CACHE`.
151+
pub ignore_block_cache: bool,
148152
/// Safety switch to increase the number of columns used when
149153
/// calculating the chunk size in `InsertQuery::chunk_size`. This can be
150154
/// used to work around Postgres errors complaining 'number of
@@ -237,6 +241,7 @@ impl TryFrom<InnerStore> for EnvVarsStore {
237241
create_gin_indexes: x.create_gin_indexes,
238242
use_brin_for_all_query_types: x.use_brin_for_all_query_types,
239243
disable_block_cache_for_lookup: x.disable_block_cache_for_lookup,
244+
ignore_block_cache: x.ignore_block_cache,
240245
insert_extra_cols: x.insert_extra_cols,
241246
fdw_fetch_size: x.fdw_fetch_size,
242247
account_like_scan_interval_hours: x.account_like_scan_interval_hours,
@@ -345,6 +350,8 @@ pub struct InnerStore {
345350
use_brin_for_all_query_types: bool,
346351
#[envconfig(from = "GRAPH_STORE_DISABLE_BLOCK_CACHE_FOR_LOOKUP", default = "false")]
347352
disable_block_cache_for_lookup: bool,
353+
#[envconfig(from = "GRAPH_STORE_IGNORE_BLOCK_CACHE", default = "false")]
354+
ignore_block_cache: bool,
348355
#[envconfig(from = "GRAPH_STORE_INSERT_EXTRA_COLS", default = "0")]
349356
insert_extra_cols: usize,
350357
#[envconfig(from = "GRAPH_STORE_FDW_FETCH_SIZE", default = "1000")]

0 commit comments

Comments
 (0)