Skip to content

Commit

Permalink
Fix BigTable upload early return (#29378)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Tyera authored Dec 23, 2022
1 parent 892e23c commit 81394cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ledger-tool/src/bigtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(())
Expand Down
6 changes: 5 additions & 1 deletion ledger/src/bigtable_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
Expand Down

0 comments on commit 81394cf

Please sign in to comment.