Add --enable-bigtable-ledger-upload flag

This commit is contained in:
Michael Vines
2020-09-03 11:30:21 -07:00
committed by mergify[bot]
parent 7b7b7be99c
commit 6101c1d690
3 changed files with 27 additions and 14 deletions

View File

@ -87,6 +87,7 @@ pub struct JsonRpcConfig {
pub faucet_addr: Option<SocketAddr>,
pub health_check_slot_distance: u64,
pub enable_bigtable_ledger_storage: bool,
pub enable_bigtable_ledger_upload: bool,
}
#[derive(Clone)]

View File

@ -272,20 +272,24 @@ impl JsonRpcService {
.build()
.expect("Runtime");
let bigtable_ledger_storage = if config.enable_bigtable_ledger_storage {
runtime
.block_on(solana_storage_bigtable::LedgerStorage::new(false))
.map(|x| {
info!("BigTable ledger storage initialized");
Some(x)
})
.unwrap_or_else(|err| {
error!("Failed to initialize BigTable ledger storage: {:?}", err);
None
})
} else {
None
};
let bigtable_ledger_storage =
if config.enable_bigtable_ledger_storage || config.enable_bigtable_ledger_upload {
runtime
.block_on(solana_storage_bigtable::LedgerStorage::new(
config.enable_bigtable_ledger_upload,
))
.map(|x| {
info!("BigTable ledger storage initialized");
Some(x)
})
.unwrap_or_else(|err| {
error!("Failed to initialize BigTable ledger storage: {:?}", err);
None
})
} else {
None
};
let request_processor = JsonRpcRequestProcessor::new(
config,
bank_forks.clone(),

View File

@ -653,6 +653,13 @@ pub fn main() {
.help("Fetch historical transaction info from a BigTable instance \
as a fallback to local ledger data"),
)
.arg(
Arg::with_name("enable_bigtable_ledger_upload")
.long("enable-bigtable-ledger-upload")
.requires("enable_rpc_transaction_history")
.takes_value(false)
.help("Upload new confirmed blocks into a BigTable instance"),
)
.arg(
Arg::with_name("health_check_slot_distance")
.long("health-check-slot-distance")
@ -970,6 +977,7 @@ pub fn main() {
enable_rpc_transaction_history: matches.is_present("enable_rpc_transaction_history"),
enable_bigtable_ledger_storage: matches
.is_present("enable_rpc_bigtable_ledger_storage"),
enable_bigtable_ledger_upload: matches.is_present("enable_bigtable_ledger_upload"),
identity_pubkey: identity_keypair.pubkey(),
faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| {
solana_net_utils::parse_host_port(address).expect("failed to parse faucet address")