-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make life easier, requires epochs_to_keep with optional overrides. otherwise, no retention policy at all strumming the pruning config. pruner.rs file will define prunable tables. the toml file when parsed into Rust config will warn if it tries to name any variants not supported by indexer code. additionally, there's also a check to make sure that prunable tables actually exist in the db
- Loading branch information
Showing
21 changed files
with
671 additions
and
67 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
crates/sui-indexer/migrations/pg/2024-09-12-213234_watermarks/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS watermarks; |
32 changes: 32 additions & 0 deletions
32
crates/sui-indexer/migrations/pg/2024-09-12-213234_watermarks/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
CREATE TABLE watermarks | ||
( | ||
-- The table governed by this watermark, i.e `epochs`, `checkpoints`, `transactions`. | ||
entity TEXT NOT NULL, | ||
-- Inclusive upper bound epoch this entity has data for. Committer updates this field. Pruner | ||
-- uses this field for per-entity epoch-level retention, and is mostly useful for pruning | ||
-- unpartitioned tables. | ||
epoch_hi BIGINT NOT NULL, | ||
-- Inclusive lower bound epoch this entity has data for. Pruner updates this field, and uses | ||
-- this field in tandem with `epoch_hi` for per-entity epoch-level retention. This is mostly | ||
-- useful for pruning unpartitioned tables. | ||
epoch_lo BIGINT NOT NULL, | ||
-- Inclusive upper bound checkpoint this entity has data for. Committer updates this field. All | ||
-- data of this entity in the checkpoint must be persisted before advancing this watermark. The | ||
-- committer or ingestion task refers to this on disaster recovery. | ||
checkpoint_hi BIGINT NOT NULL, | ||
-- Inclusive high watermark that the committer advances. For `checkpoints`, this represents the | ||
-- checkpoint sequence number, for `transactions`, the transaction sequence number, etc. | ||
reader_hi BIGINT NOT NULL, | ||
-- Inclusive low watermark that the pruner advances. Data before this watermark is considered | ||
-- pruned by a reader. The underlying data may still exist in the db instance. | ||
reader_lo BIGINT NOT NULL, | ||
-- Updated using the database's current timestamp when the pruner sees that some data needs to | ||
-- 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 has | ||
-- been truly pruned from the db, and should no longer exist. When recovering from a crash, the | ||
-- pruner will consult this column to determine where to continue. | ||
pruned_lo BIGINT, | ||
PRIMARY KEY (entity) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.