Refactor validator bigtable config
This commit is contained in:
committed by
Trent Nelson
parent
99f1a43262
commit
63ee00e647
@ -146,13 +146,11 @@ pub struct JsonRpcConfig {
|
|||||||
pub enable_cpi_and_log_storage: bool,
|
pub enable_cpi_and_log_storage: bool,
|
||||||
pub faucet_addr: Option<SocketAddr>,
|
pub faucet_addr: Option<SocketAddr>,
|
||||||
pub health_check_slot_distance: u64,
|
pub health_check_slot_distance: u64,
|
||||||
pub enable_bigtable_ledger_storage: bool,
|
pub rpc_bigtable_config: Option<RpcBigtableConfig>,
|
||||||
pub enable_bigtable_ledger_upload: bool,
|
|
||||||
pub max_multiple_accounts: Option<usize>,
|
pub max_multiple_accounts: Option<usize>,
|
||||||
pub account_indexes: AccountSecondaryIndexes,
|
pub account_indexes: AccountSecondaryIndexes,
|
||||||
pub rpc_threads: usize,
|
pub rpc_threads: usize,
|
||||||
pub rpc_niceness_adj: i8,
|
pub rpc_niceness_adj: i8,
|
||||||
pub rpc_bigtable_timeout: Option<Duration>,
|
|
||||||
pub full_api: bool,
|
pub full_api: bool,
|
||||||
pub obsolete_v1_7_api: bool,
|
pub obsolete_v1_7_api: bool,
|
||||||
pub rpc_scan_and_fix_roots: bool,
|
pub rpc_scan_and_fix_roots: bool,
|
||||||
@ -167,6 +165,12 @@ impl JsonRpcConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Default, Clone)]
|
||||||
|
pub struct RpcBigtableConfig {
|
||||||
|
pub enable_bigtable_ledger_upload: bool,
|
||||||
|
pub timeout: Option<Duration>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct JsonRpcRequestProcessor {
|
pub struct JsonRpcRequestProcessor {
|
||||||
bank_forks: Arc<RwLock<BankForks>>,
|
bank_forks: Arc<RwLock<BankForks>>,
|
||||||
|
@ -376,18 +376,21 @@ impl JsonRpcService {
|
|||||||
let exit_bigtable_ledger_upload_service = Arc::new(AtomicBool::new(false));
|
let exit_bigtable_ledger_upload_service = Arc::new(AtomicBool::new(false));
|
||||||
|
|
||||||
let (bigtable_ledger_storage, _bigtable_ledger_upload_service) =
|
let (bigtable_ledger_storage, _bigtable_ledger_upload_service) =
|
||||||
if config.enable_bigtable_ledger_storage || config.enable_bigtable_ledger_upload {
|
if let Some(RpcBigtableConfig {
|
||||||
|
enable_bigtable_ledger_upload,
|
||||||
|
timeout,
|
||||||
|
}) = config.rpc_bigtable_config
|
||||||
|
{
|
||||||
runtime
|
runtime
|
||||||
.block_on(solana_storage_bigtable::LedgerStorage::new(
|
.block_on(solana_storage_bigtable::LedgerStorage::new(
|
||||||
!config.enable_bigtable_ledger_upload,
|
!enable_bigtable_ledger_upload,
|
||||||
config.rpc_bigtable_timeout,
|
timeout,
|
||||||
None,
|
None,
|
||||||
))
|
))
|
||||||
.map(|bigtable_ledger_storage| {
|
.map(|bigtable_ledger_storage| {
|
||||||
info!("BigTable ledger storage initialized");
|
info!("BigTable ledger storage initialized");
|
||||||
|
|
||||||
let bigtable_ledger_upload_service = if config.enable_bigtable_ledger_upload
|
let bigtable_ledger_upload_service = if enable_bigtable_ledger_upload {
|
||||||
{
|
|
||||||
Some(Arc::new(BigTableUploadService::new(
|
Some(Arc::new(BigTableUploadService::new(
|
||||||
runtime.clone(),
|
runtime.clone(),
|
||||||
bigtable_ledger_storage.clone(),
|
bigtable_ledger_storage.clone(),
|
||||||
|
@ -40,7 +40,10 @@ use {
|
|||||||
solana_perf::recycler::enable_recycler_warming,
|
solana_perf::recycler::enable_recycler_warming,
|
||||||
solana_poh::poh_service,
|
solana_poh::poh_service,
|
||||||
solana_replica_lib::accountsdb_repl_server::AccountsDbReplServiceConfig,
|
solana_replica_lib::accountsdb_repl_server::AccountsDbReplServiceConfig,
|
||||||
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
|
solana_rpc::{
|
||||||
|
rpc::{JsonRpcConfig, RpcBigtableConfig},
|
||||||
|
rpc_pubsub_service::PubSubConfig,
|
||||||
|
},
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
accounts_db::{
|
accounts_db::{
|
||||||
AccountShrinkThreshold, AccountsDbConfig, DEFAULT_ACCOUNTS_SHRINK_OPTIMIZE_TOTAL_SPACE,
|
AccountShrinkThreshold, AccountsDbConfig, DEFAULT_ACCOUNTS_SHRINK_OPTIMIZE_TOTAL_SPACE,
|
||||||
@ -2274,6 +2277,19 @@ pub fn main() {
|
|||||||
warn!("--minimal-rpc-api is now the default behavior. This flag is deprecated and can be removed from the launch args")
|
warn!("--minimal-rpc-api is now the default behavior. This flag is deprecated and can be removed from the launch args")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let rpc_bigtable_config = if matches.is_present("enable_rpc_bigtable_ledger_storage")
|
||||||
|
|| matches.is_present("enable_bigtable_ledger_upload")
|
||||||
|
{
|
||||||
|
Some(RpcBigtableConfig {
|
||||||
|
enable_bigtable_ledger_upload: matches.is_present("enable_bigtable_ledger_upload"),
|
||||||
|
timeout: value_t!(matches, "rpc_bigtable_timeout", u64)
|
||||||
|
.ok()
|
||||||
|
.map(Duration::from_secs),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let mut validator_config = ValidatorConfig {
|
let mut validator_config = ValidatorConfig {
|
||||||
require_tower: matches.is_present("require_tower"),
|
require_tower: matches.is_present("require_tower"),
|
||||||
tower_storage,
|
tower_storage,
|
||||||
@ -2289,9 +2305,7 @@ pub fn main() {
|
|||||||
rpc_config: JsonRpcConfig {
|
rpc_config: JsonRpcConfig {
|
||||||
enable_rpc_transaction_history: matches.is_present("enable_rpc_transaction_history"),
|
enable_rpc_transaction_history: matches.is_present("enable_rpc_transaction_history"),
|
||||||
enable_cpi_and_log_storage: matches.is_present("enable_cpi_and_log_storage"),
|
enable_cpi_and_log_storage: matches.is_present("enable_cpi_and_log_storage"),
|
||||||
enable_bigtable_ledger_storage: matches
|
rpc_bigtable_config,
|
||||||
.is_present("enable_rpc_bigtable_ledger_storage"),
|
|
||||||
enable_bigtable_ledger_upload: matches.is_present("enable_bigtable_ledger_upload"),
|
|
||||||
faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| {
|
faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| {
|
||||||
solana_net_utils::parse_host_port(address).expect("failed to parse faucet address")
|
solana_net_utils::parse_host_port(address).expect("failed to parse faucet address")
|
||||||
}),
|
}),
|
||||||
@ -2309,9 +2323,6 @@ pub fn main() {
|
|||||||
),
|
),
|
||||||
rpc_threads: value_t_or_exit!(matches, "rpc_threads", usize),
|
rpc_threads: value_t_or_exit!(matches, "rpc_threads", usize),
|
||||||
rpc_niceness_adj: value_t_or_exit!(matches, "rpc_niceness_adj", i8),
|
rpc_niceness_adj: value_t_or_exit!(matches, "rpc_niceness_adj", i8),
|
||||||
rpc_bigtable_timeout: value_t!(matches, "rpc_bigtable_timeout", u64)
|
|
||||||
.ok()
|
|
||||||
.map(Duration::from_secs),
|
|
||||||
account_indexes: account_indexes.clone(),
|
account_indexes: account_indexes.clone(),
|
||||||
rpc_scan_and_fix_roots: matches.is_present("rpc_scan_and_fix_roots"),
|
rpc_scan_and_fix_roots: matches.is_present("rpc_scan_and_fix_roots"),
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user