Fix BigTable upload early return (#29378)

* Change Err when slot range is empty to Ok and log; add method docs

* Update var and log to be more correct

* Promote log level to warn
This commit is contained in:
Tyera 2022-12-23 11:11:27 -07:00 committed by GitHub
parent 892e23ce08
commit 81394cf92c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -60,7 +60,7 @@ async fn upload(
ending_slot,
starting_slot.saturating_add(config.max_num_slots_to_check as u64 * 2),
);
let last_slot_uploaded = solana_ledger::bigtable_upload::upload_confirmed_blocks(
let last_slot_checked = solana_ledger::bigtable_upload::upload_confirmed_blocks(
blockstore.clone(),
bigtable.clone(),
starting_slot,
@ -69,8 +69,8 @@ async fn upload(
Arc::new(AtomicBool::new(false)),
)
.await?;
info!("last slot uploaded: {}", last_slot_uploaded);
starting_slot = last_slot_uploaded.saturating_add(1);
info!("last slot checked: {}", last_slot_checked);
starting_slot = last_slot_checked.saturating_add(1);
}
info!("No more blocks to upload.");
Ok(())

View File

@ -41,6 +41,9 @@ struct BlockstoreLoadStats {
pub elapsed: Duration,
}
/// Uploads a range of blocks from a Blockstore to bigtable LedgerStorage
/// Returns the Slot of the last block checked. If no blocks in the range `[staring_slot,
/// ending_slot]` are found in Blockstore, this value is equal to `ending_slot`.
pub async fn upload_confirmed_blocks(
blockstore: Arc<Blockstore>,
bigtable: solana_storage_bigtable::LedgerStorage,
@ -61,7 +64,8 @@ pub async fn upload_confirmed_blocks(
.collect();
if blockstore_slots.is_empty() {
return Err(format!("Ledger has no slots from {starting_slot} to {ending_slot:?}").into());
warn!("Ledger has no slots from {starting_slot} to {ending_slot:?}");
return Ok(ending_slot);
}
let first_blockstore_slot = blockstore_slots.first().unwrap();