This reverts commit 73d469991f
.
This commit is contained in:
@ -2,16 +2,21 @@ use {
|
|||||||
crate::{bigtable_upload, blockstore::Blockstore},
|
crate::{bigtable_upload, blockstore::Blockstore},
|
||||||
solana_runtime::commitment::BlockCommitmentCache,
|
solana_runtime::commitment::BlockCommitmentCache,
|
||||||
std::{
|
std::{
|
||||||
cmp::min,
|
sync::atomic::{AtomicBool, Ordering},
|
||||||
sync::{
|
sync::{Arc, RwLock},
|
||||||
atomic::{AtomicBool, AtomicU64, Ordering},
|
|
||||||
Arc, RwLock,
|
|
||||||
},
|
|
||||||
thread::{self, Builder, JoinHandle},
|
thread::{self, Builder, JoinHandle},
|
||||||
},
|
},
|
||||||
tokio::runtime::Runtime,
|
tokio::runtime::Runtime,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Delay uploading the largest confirmed root for this many slots. This is done in an attempt to
|
||||||
|
// ensure that the `CacheBlockMetaService` has had enough time to add the block time for the root
|
||||||
|
// before it's uploaded to BigTable.
|
||||||
|
//
|
||||||
|
// A more direct connection between CacheBlockMetaService and BigTableUploadService would be
|
||||||
|
// preferable...
|
||||||
|
const LARGEST_CONFIRMED_ROOT_UPLOAD_DELAY: usize = 100;
|
||||||
|
|
||||||
pub struct BigTableUploadService {
|
pub struct BigTableUploadService {
|
||||||
thread: JoinHandle<()>,
|
thread: JoinHandle<()>,
|
||||||
}
|
}
|
||||||
@ -22,7 +27,6 @@ impl BigTableUploadService {
|
|||||||
bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage,
|
bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage,
|
||||||
blockstore: Arc<Blockstore>,
|
blockstore: Arc<Blockstore>,
|
||||||
block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>,
|
block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>,
|
||||||
max_complete_transaction_status_slot: Arc<AtomicU64>,
|
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
info!("Starting BigTable upload service");
|
info!("Starting BigTable upload service");
|
||||||
@ -34,7 +38,6 @@ impl BigTableUploadService {
|
|||||||
bigtable_ledger_storage,
|
bigtable_ledger_storage,
|
||||||
blockstore,
|
blockstore,
|
||||||
block_commitment_cache,
|
block_commitment_cache,
|
||||||
max_complete_transaction_status_slot,
|
|
||||||
exit,
|
exit,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -48,7 +51,6 @@ impl BigTableUploadService {
|
|||||||
bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage,
|
bigtable_ledger_storage: solana_storage_bigtable::LedgerStorage,
|
||||||
blockstore: Arc<Blockstore>,
|
blockstore: Arc<Blockstore>,
|
||||||
block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>,
|
block_commitment_cache: Arc<RwLock<BlockCommitmentCache>>,
|
||||||
max_complete_transaction_status_slot: Arc<AtomicU64>,
|
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
) {
|
) {
|
||||||
let mut start_slot = 0;
|
let mut start_slot = 0;
|
||||||
@ -57,10 +59,11 @@ impl BigTableUploadService {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let end_slot = min(
|
let end_slot = block_commitment_cache
|
||||||
max_complete_transaction_status_slot.load(Ordering::SeqCst),
|
.read()
|
||||||
block_commitment_cache.read().unwrap().root(),
|
.unwrap()
|
||||||
);
|
.highest_confirmed_root()
|
||||||
|
.saturating_sub(LARGEST_CONFIRMED_ROOT_UPLOAD_DELAY as u64);
|
||||||
|
|
||||||
if end_slot <= start_slot {
|
if end_slot <= start_slot {
|
||||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||||
|
@ -339,7 +339,6 @@ impl JsonRpcService {
|
|||||||
bigtable_ledger_storage.clone(),
|
bigtable_ledger_storage.clone(),
|
||||||
blockstore.clone(),
|
blockstore.clone(),
|
||||||
block_commitment_cache.clone(),
|
block_commitment_cache.clone(),
|
||||||
current_transaction_status_slot.clone(),
|
|
||||||
exit_bigtable_ledger_upload_service.clone(),
|
exit_bigtable_ledger_upload_service.clone(),
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user