Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[indexer][watermarks][2/n] committer writes upper bounds to watermarks table #19649

Open
wants to merge 5 commits into
base: indexer/pruner-config
Choose a base branch
from

Conversation

wlmyng
Copy link
Contributor

@wlmyng wlmyng commented Oct 2, 2024

Description

Adds watermarks table, and has committer writing upper bounds to it.

The committer works on the checkpoints level, so to simplify what it needs to do, we can have the committer call store.update_watermarks_upper_bound() once when it completes its batch of work. The upper bound update function relies on PrunableTable to tell it which of epoch, cp, or tx should be used to update the upper bound.

Part of a stack of PRs for watermarks

  1. simplify setting up test indexer: [indexer] Simplify setting up a test indexer writer or reader #19663
  2. update pruner config: [indexer][watermarks][1/n] Modify PruningOptions to point to a toml file of epochs_to_keep and optional per-table overrides #19637
  3. committer writes upper bounds [indexer][watermarks][2/n] committer writes upper bounds to watermarks table #19649
  4. pruner writes lower bounds: [indexer][watermarks][3/n] pruner updates watermarks lower bound #19650
  5. pruner prunes (wip)

Test plan

How did you test the new or updated feature?


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Oct 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2024 8:57pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Oct 3, 2024 8:57pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Oct 3, 2024 8:57pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Oct 3, 2024 8:57pm

@wlmyng wlmyng changed the base branch from main to indexer/pruner-config October 2, 2024 00:26
@wlmyng wlmyng force-pushed the indexer/pruner-config branch 2 times, most recently from b8f4fea to 5cdcd79 Compare October 2, 2024 17:26
@wlmyng wlmyng force-pushed the indexer/committer-updates-watermarks-upper-bound branch from 09e384e to 2482cda Compare October 2, 2024 17:32
@wlmyng wlmyng force-pushed the indexer/committer-updates-watermarks-upper-bound branch from 2482cda to 7fdf941 Compare October 2, 2024 17:35
@wlmyng wlmyng force-pushed the indexer/pruner-config branch 2 times, most recently from 5065a0a to 1157e65 Compare October 2, 2024 20:32
@wlmyng wlmyng force-pushed the indexer/committer-updates-watermarks-upper-bound branch from 7fdf941 to 03be8f5 Compare October 2, 2024 20:34
@wlmyng wlmyng force-pushed the indexer/committer-updates-watermarks-upper-bound branch from 03be8f5 to ec26f93 Compare October 2, 2024 21:09
@wlmyng wlmyng marked this pull request as ready for review October 2, 2024 23:41
…iating an indexer writer and reader into separate functions, and use those functions in tests where we previously clobbered everything into a single function.
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
@@ -212,6 +228,22 @@ async fn commit_checkpoints<S>(
})
.expect("Persisting data into DB should not fail.");

state
.update_watermarks_upper_bound(
PrunableTable::iter().collect(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about tables that are un-prunable while we still want to track the hi watermark, like epochs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think readers can just use the available data itself as the range, if needed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's counter-intuitive that watermarks is actually prunable_table_watermarks -- I propose to extend that to all tables if it's not the plan.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can do that in a separate pr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see what you mean
i dont think it'll hurt for pruner to prune a subset of the tables that committer pushes upper bounds to. For those unpruned tables, the reader_lo will remain at 0. Or perhaps yeah we can have a prunable_table_watermarks instead of a flat watermarks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think having reader_lo at 0 seems benign too, and watermarks can be more useful covering all tables, for example if we want to check if all tables have reached certain checkpoint (except snapshot table), we can go to watermarks and run one quick query to do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not trying to block you, and I can do the extension too if that helps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no worries, better to hash it out now when the table doesnt exist yet
i like the idea of being able to check overall instance status

wlmyng added a commit that referenced this pull request Oct 4, 2024
## Description 

Currently, tests that require spinning up an indexer do so through
`start_test_indexer_impl` or `start_test_indexer`. This is further
complicated by a single `start` function that accepts a
`ReaderWriterConfig`. We can simplify this by exposing two functions
with optional parameters that can be configured by the caller.

Part of a stack of PRs for watermarks
1. simplify setting up test indexer:
#19663
2. update pruner config: #19637
3. committer writes upper bounds
#19649
4. pruner writes lower bounds:
#19650
5. pruner prunes (wip)

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants