Skip to content

Commit 627c594

Browse files
authored
[archival deprecation] migrate indexer restorer (#21999)
## Description migrates indexer restoration from previous archive to checkpoint bucket --- ## 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): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK:
1 parent a09770a commit 627c594

File tree

4 files changed

+8
-33
lines changed

4 files changed

+8
-33
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/sui-indexer-alt-restorer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ diesel-async = { workspace = true, features = ["bb8", "postgres", "async-connect
1919
indicatif.workspace = true
2020
object_store.workspace = true
2121
prometheus.workspace = true
22-
sui-archival.workspace = true
2322
sui-config.workspace = true
2423
sui-core.workspace = true
24+
sui-data-ingestion-core.workspace = true
2525
sui-field-count.workspace = true
2626
sui-indexer-alt-schema.workspace = true
2727
sui-indexer-alt-framework.workspace = true

crates/sui-indexer-alt-restorer/src/archives.rs

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
// Copyright (c) Mysten Labs, Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use std::num::NonZeroUsize;
5-
6-
use prometheus::Registry;
7-
use tracing::info;
8-
9-
use sui_archival::reader::{ArchiveReader, ArchiveReaderMetrics};
10-
use sui_config::node::ArchiveReaderConfig;
11-
use sui_config::object_storage_config::{ObjectStoreConfig, ObjectStoreType};
12-
134
use crate::Args;
5+
use sui_data_ingestion_core::end_of_epoch_data;
6+
use tracing::info;
147

158
#[derive(Clone, Debug)]
169
pub(crate) struct ArchivalCheckpointInfo {
@@ -21,26 +14,8 @@ impl ArchivalCheckpointInfo {
2114
/// Reads checkpoint information from archival storage to determine,
2215
/// specifically the next checkpoint number after `start_epoch` for watermarking.
2316
pub async fn read_archival_checkpoint_info(args: &Args) -> anyhow::Result<Self> {
24-
// Configure GCS object store and initialize archive reader with minimal concurrency.
25-
let archive_store_config = ObjectStoreConfig {
26-
object_store: Some(ObjectStoreType::GCS),
27-
bucket: Some(args.archive_bucket.clone()),
28-
object_store_connection_limit: 1, // 1 connection is sufficient
29-
no_sign_request: false,
30-
..Default::default()
31-
};
32-
let archive_reader_config = ArchiveReaderConfig {
33-
remote_store_config: archive_store_config,
34-
download_concurrency: NonZeroUsize::new(1).unwrap(),
35-
ingestion_url: None,
36-
};
37-
let metrics = ArchiveReaderMetrics::new(&Registry::default());
38-
let archive_reader = ArchiveReader::new(archive_reader_config, &metrics)?;
39-
40-
// Sync and read manifest to get next checkpoint after `start_epoch` for watermarking.
41-
archive_reader.sync_manifest_once().await?;
42-
let manifest = archive_reader.get_manifest().await?;
43-
let next_checkpoint_after_epoch = manifest.next_checkpoint_after_epoch(args.start_epoch);
17+
let checkpoints = end_of_epoch_data(args.archive_url.clone(), vec![], 5).await?;
18+
let next_checkpoint_after_epoch = checkpoints[args.start_epoch as usize] + 1;
4419
info!(
4520
epoch = args.start_epoch,
4621
checkpoint = next_checkpoint_after_epoch,

crates/sui-indexer-alt-restorer/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub struct Args {
2828
pub snapshot_bucket: String,
2929

3030
/// Bucket to fetch archive files from.
31-
#[clap(long, env = "ARCHIVE_BUCKET", required = true)]
32-
pub archive_bucket: String,
31+
#[clap(long, env = "ARCHIVE_URL", required = true)]
32+
pub archive_url: String,
3333

3434
/// Local directory to temporarily store snapshot files.
3535
#[clap(long, env = "SNAPSHOT_LOCAL_DIR", required = true)]

0 commit comments

Comments
 (0)