-
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.
indexer formal restore 1/N: restore packages and move objects (#18886)
## Description first of the stack PR to restore indexer from sui archives & formal snapshot ## Test plan test locally with GCS buckets, local snapshot dir and local PG server ``` ██████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 75 out of 555 move object files restored (Restored 569395 live move objects and 0 wrapped or deleted objects from epoch_500/1_53.obj)2024-09-10T14:21:39.854508Z INFO sui_indexer::restorer::formal_snapshot: Finished downloading move object file Path { raw: "epoch_500/1_125.obj" } 2024-09-10T14:21:44.111960Z INFO sui_indexer::restorer::formal_snapshot: Start persisting 565556 move objects from epoch_500/1_125.obj 2024-09-10T14:22:12.142760Z INFO sui_indexer::store::pg_indexer_store: Persisted 563126 objects snapshot elapsed=7058.20103075 2024-09-10T14:22:12.142830Z INFO sui_indexer::restorer::formal_snapshot: Finished persisting 0 wrapped or deleted objects from epoch_500/1_86.obj [10:46:20] ``` need to benchmark in the production env --- ## 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:
- Loading branch information
Showing
11 changed files
with
476 additions
and
97 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::num::NonZeroUsize; | ||
|
||
use prometheus::Registry; | ||
use tracing::info; | ||
|
||
use sui_archival::reader::{ArchiveReader, ArchiveReaderMetrics}; | ||
use sui_config::node::ArchiveReaderConfig; | ||
use sui_config::object_storage_config::{ObjectStoreConfig, ObjectStoreType}; | ||
|
||
use crate::types::IndexerResult; | ||
|
||
pub async fn read_next_checkpoint_after_epoch( | ||
cred_path: String, | ||
archive_bucket: Option<String>, | ||
epoch: u64, | ||
) -> IndexerResult<u64> { | ||
let archive_store_config = ObjectStoreConfig { | ||
object_store: Some(ObjectStoreType::GCS), | ||
bucket: archive_bucket, | ||
google_service_account: Some(cred_path.clone()), | ||
object_store_connection_limit: 50, | ||
no_sign_request: false, | ||
..Default::default() | ||
}; | ||
let archive_reader_config = ArchiveReaderConfig { | ||
remote_store_config: archive_store_config, | ||
download_concurrency: NonZeroUsize::new(50).unwrap(), | ||
use_for_pruning_watermark: false, | ||
}; | ||
let metrics = ArchiveReaderMetrics::new(&Registry::default()); | ||
let archive_reader = ArchiveReader::new(archive_reader_config, &metrics)?; | ||
archive_reader.sync_manifest_once().await?; | ||
let manifest = archive_reader.get_manifest().await?; | ||
let next_checkpoint_after_epoch = manifest.next_checkpoint_after_epoch(epoch); | ||
info!( | ||
"Read from archives: next checkpoint sequence after epoch {} is: {}", | ||
epoch, next_checkpoint_after_epoch | ||
); | ||
Ok(next_checkpoint_after_epoch) | ||
} |
Oops, something went wrong.