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

Add ledger-tool bigtable upload loop #26030

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions ledger-tool/src/bigtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use {

async fn upload(
blockstore: Blockstore,
starting_slot: Slot,
mut starting_slot: Slot,
ending_slot: Option<Slot>,
force_reupload: bool,
config: solana_storage_bigtable::LedgerStorageConfig,
Expand All @@ -49,19 +49,27 @@ async fn upload(
force_reupload,
..ConfirmedBlockUploadConfig::default()
};
let blockstore = Arc::new(blockstore);
let mut last_slot_uploaded = 0;

solana_ledger::bigtable_upload::upload_confirmed_blocks(
Arc::new(blockstore),
bigtable,
starting_slot,
ending_slot,
config,
Arc::new(AtomicBool::new(false)),
)
.await
.map(|last_slot_uploaded| {
loop {
if starting_slot > 0 && starting_slot == last_slot_uploaded {
CriesofCarrots marked this conversation as resolved.
Show resolved Hide resolved
break;
}
starting_slot = last_slot_uploaded;
last_slot_uploaded = solana_ledger::bigtable_upload::upload_confirmed_blocks(
blockstore.clone(),
bigtable.clone(),
starting_slot,
ending_slot,
config.clone(),
Arc::new(AtomicBool::new(false)),
)
.await?;
info!("last slot uploaded: {}", last_slot_uploaded);
})
}
info!("No more blocks to upload.");
Ok(())
}

async fn delete_slots(
Expand Down