Skip to content

[archival] swtich state sync from archival store to checkpoints bucket #21955

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

Merged
merged 1 commit into from
Apr 28, 2025

Conversation

phoenix-o
Copy link
Contributor

@phoenix-o phoenix-o commented Apr 23, 2025

Description

Part 1 of deprecation of existing archival storage.
Notes:

  • switches StateSync from archival store to checkpoint bucket
  • removes the notion of archival from pruning policies
  • removes write-archival config from Sui node config

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): Switches Sui archive mechanism for state sync from the existing format to checkpoint data ingestion bucket. The state-archive-read-config section of the full node config needs to be updated to include the ingestion-url field. For possible bucket options, see: https://docs.sui.io/guides/developer/advanced/custom-indexer#remote-reader.
  • gRPC:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented Apr 23, 2025

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 Apr 25, 2025 5:37pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Apr 25, 2025 5:37pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Apr 25, 2025 5:37pm

@bmwill
Copy link
Contributor

bmwill commented Apr 23, 2025

Adding @aschran since he's more recently worked in this area than i have. I'm still planning on doing a review though :)

Comment on lines 96 to +102
if let Some(limit) = upper_limit {
if checkpoint.checkpoint_summary.sequence_number > limit {
if sequence_number > limit && self.pool_senders.len() == 1 {
break;
}
}
}
Some(checkpoint) = checkpoint_recv.recv() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a bug fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

depends — the semantics have changed. Previously, it was "don't process checkpoints with sequence number > upper_limit", and now it's "ensure that all checkpoints up to upper_limit are processed". Both work for state sync, but I think the latter is better. From what I can tell, the parameter isn’t currently used anywhere in the codebase

Comment on lines 6 to 9
pub mod writer;

#[cfg(test)]
mod tests;
Copy link
Contributor

Choose a reason for hiding this comment

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

So the writer is being removed immediately? How does this impact the infra that we're running today for populating the archival? Or is this the archival that used to run inside the node and the one that runs as a part of ingestion framework still functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, that's the old writer. Data ingestion still works after the change

Comment on lines 1150 to 1179
'inner: {
let start = highest_synced
.checked_add(1)
.expect("Checkpoint seq num overflow");
let end = lowest_checkpoint_on_peers.unwrap();

let Some(ref archive_config) = archive_config else {
warn!("Failed to find an archive reader to complete the state sync request");
break 'inner;
};
let Some(ref ingestion_url) = archive_config.ingestion_url else {
warn!("Archival ingestion url for state sync is not configured");
break 'inner;
};
let reader_options = ReaderOptions {
batch_size: archive_config.download_concurrency.into(),
upper_limit: Some(end),
..Default::default()
};
let Ok((executor, _exit_sender)) = setup_single_workflow(
StateSyncWorker(store.clone()),
ingestion_url.clone(),
start,
1,
Some(reader_options),
)
.await
{
let txn_counter = Arc::new(AtomicU64::new(0));
let checkpoint_counter = Arc::new(AtomicU64::new(0));
if let Err(err) = archive_reader
.read(
store.clone(),
checkpoint_range,
txn_counter.clone(),
checkpoint_counter.clone(),
true,
)
.await
{
warn!("State sync from archive failed with error: {:?}", err);
} else {
info!("State sync from archive is complete. Checkpoints downloaded = {:?}, Txns downloaded = {:?}", checkpoint_counter.load(Ordering::Relaxed), txn_counter.load(Ordering::Relaxed));
else {
break 'inner;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm having a little bit of trouble understanding the break 'inner control flow here. would this maybe be clearer if it was a separate function that could early return or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it just skips to the last statement in the loop(i.e. sleep), but I don't mind

Copy link
Contributor

@bmwill bmwill left a comment

Choose a reason for hiding this comment

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

Thanks!

Lets also make sure to add some information into the release notes about this change.

cc @abhinavg6

@abhinavg6
Copy link
Contributor

@bmwill - By release notes, do you mean those would be available here - https://github.com/MystenLabs/sui/releases?

Also, considering this is part 1 of deprecation, is it worth documenting our overall intent now at https://docs.sui.io/guides/operator/archives and any other pertinent places? Or shall we wait until deprecation happens when we have the Bigtable interface for KV store?

@bmwill
Copy link
Contributor

bmwill commented Apr 25, 2025

For release notes, checking a box and adding some info in the PR cover letter should suffice. As for documentation's our plans, yeah we should probably start doing that.

@phoenix-o
Copy link
Contributor Author

I updated release note section. Feel free to edit it to better reflect the change.

Or shall we wait until deprecation happens when we have the Bigtable interface for KV store?

The change is not related to the KV store. The previous archive solution will be replaced by the existing ingestion bucket of checkpoints

@phoenix-o phoenix-o temporarily deployed to sui-typescript-aws-kms-test-env April 25, 2025 17:35 — with GitHub Actions Inactive
@phoenix-o phoenix-o merged commit 1dabb5c into MystenLabs:main Apr 28, 2025
47 checks passed
lwedge99 pushed a commit to sentioxyz/sui that referenced this pull request Jun 3, 2025
MystenLabs#21955)

## Description 

Part 1 of deprecation of existing archival storage.
Notes:
* switches StateSync from archival store to checkpoint bucket
* removes the notion of archival from pruning policies
* removes write-archival config from Sui node config

---

## 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: 
- [x] Nodes (Validators and Full nodes): 
Switches Sui archive mechanism for state sync from the existing format
to checkpoint data ingestion bucket.
The `state-archive-read-config` section of the full node config needs to
be updated to include the `ingestion-url` field.
For possible bucket options, see:
https://docs.sui.io/guides/developer/advanced/custom-indexer#remote-reader.
- [ ] gRPC:
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
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.

3 participants