diff --git a/crates/sui-indexer/migrations/pg/2024-09-12-213234_watermarks/up.sql b/crates/sui-indexer/migrations/pg/2024-09-12-213234_watermarks/up.sql index 57dd6e130954d..e8499c692120c 100644 --- a/crates/sui-indexer/migrations/pg/2024-09-12-213234_watermarks/up.sql +++ b/crates/sui-indexer/migrations/pg/2024-09-12-213234_watermarks/up.sql @@ -22,5 +22,8 @@ CREATE TABLE watermarks -- be dropped. The pruner uses this column to determine whether to prune or wait long enough -- that all in-flight reads complete or timeout before it acts on an updated watermark. timestamp_ms BIGINT NOT NULL, + -- Column used by the pruner to track its true progress. Data at and below this watermark can + -- be immediately pruned. + pruner_lo BIGINT, PRIMARY KEY (entity) ); diff --git a/crates/sui-indexer/src/models/watermarks.rs b/crates/sui-indexer/src/models/watermarks.rs index e3e815a16a3d4..a04d99a1404c2 100644 --- a/crates/sui-indexer/src/models/watermarks.rs +++ b/crates/sui-indexer/src/models/watermarks.rs @@ -36,6 +36,9 @@ pub struct StoredWatermark { /// be dropped. The pruner uses this column to determine whether to prune or wait long enough /// that all in-flight reads complete or timeout before it acts on an updated watermark. pub timestamp_ms: i64, + /// Column used by the pruner to track its true progress. Data at and below this watermark can + /// be immediately pruned. + pub pruner_lo: Option, } impl StoredWatermark { diff --git a/crates/sui-indexer/src/schema.rs b/crates/sui-indexer/src/schema.rs index 7f5260c53eb5f..a2c418db8e042 100644 --- a/crates/sui-indexer/src/schema.rs +++ b/crates/sui-indexer/src/schema.rs @@ -378,6 +378,7 @@ diesel::table! { tx_hi_inclusive -> Int8, reader_lo -> Int8, timestamp_ms -> Int8, + pruner_lo -> Nullable, } }