Skip to content

Commit 323fda7

Browse files
goffrieConvex, Inc.
authored andcommitted
Split index backfill table iterator page size knob (#42501)
INDEX_BACKFILL_CHUNK_SIZE controls write chunks, INDEX_BACKFILL_READ_SIZE controls TableIterator pages. GitOrigin-RevId: a43caa579e21a5f339191a725ac9bb47b930a08a
1 parent dfeda82 commit 323fda7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

crates/common/src/knobs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ pub static ENABLE_INDEX_BACKFILL: LazyLock<bool> =
425425
pub static INDEX_BACKFILL_CHUNK_RATE: LazyLock<NonZeroU32> =
426426
LazyLock::new(|| env_config("INDEX_BACKFILL_CHUNK_RATE", NonZeroU32::new(16).unwrap()));
427427

428+
/// The page size to use when reading the table for an index backfill.
429+
pub static INDEX_BACKFILL_READ_SIZE: LazyLock<usize> =
430+
LazyLock::new(|| env_config("INDEX_BACKFILL_READ_SIZE", 500));
431+
428432
/// How many index entries to write within a single database transaction.
429433
/// Value is a tradeoff between grouping work, vs tying up resources on the
430434
/// database, vs holding all entries in memory.

crates/database/src/database_index_workers/index_writer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use common::{
1616
INDEX_BACKFILL_CHUNK_RATE,
1717
INDEX_BACKFILL_CHUNK_SIZE,
1818
INDEX_BACKFILL_PROGRESS_INTERVAL,
19+
INDEX_BACKFILL_READ_SIZE,
1920
INDEX_BACKFILL_WORKERS,
2021
},
2122
persistence::{
@@ -266,7 +267,7 @@ impl<RT: Runtime> IndexWriter<RT> {
266267
snapshot_ts,
267268
self.reader.clone(),
268269
self.retention_validator.clone(),
269-
INDEX_BACKFILL_CHUNK_SIZE.get() as usize,
270+
*INDEX_BACKFILL_READ_SIZE,
270271
);
271272

272273
let (index_update_tx, index_update_rx) = mpsc::channel(32);

0 commit comments

Comments
 (0)