(LedgerStore) Rename BlockstoreAdvancedOptions to LedgerColumnOptions (#23764)
This PR renames BlockstoreAdvancedOptions to LedgerColumnOptions, as we will pass-down this struct to LedgerColumn to allow it to perform metric reporting.
This commit is contained in:
parent
56428be629
commit
f999eef452
|
@ -38,7 +38,7 @@ use {
|
||||||
blockstore::{
|
blockstore::{
|
||||||
Blockstore, BlockstoreError, BlockstoreSignals, CompletedSlotsReceiver, PurgeType,
|
Blockstore, BlockstoreError, BlockstoreSignals, CompletedSlotsReceiver, PurgeType,
|
||||||
},
|
},
|
||||||
blockstore_db::{BlockstoreAdvancedOptions, BlockstoreOptions, BlockstoreRecoveryMode},
|
blockstore_db::{BlockstoreOptions, BlockstoreRecoveryMode, LedgerColumnOptions},
|
||||||
blockstore_processor::{self, TransactionStatusSender},
|
blockstore_processor::{self, TransactionStatusSender},
|
||||||
leader_schedule::FixedSchedule,
|
leader_schedule::FixedSchedule,
|
||||||
leader_schedule_cache::LeaderScheduleCache,
|
leader_schedule_cache::LeaderScheduleCache,
|
||||||
|
@ -168,7 +168,7 @@ pub struct ValidatorConfig {
|
||||||
pub no_wait_for_vote_to_start_leader: bool,
|
pub no_wait_for_vote_to_start_leader: bool,
|
||||||
pub accounts_shrink_ratio: AccountShrinkThreshold,
|
pub accounts_shrink_ratio: AccountShrinkThreshold,
|
||||||
pub wait_to_vote_slot: Option<Slot>,
|
pub wait_to_vote_slot: Option<Slot>,
|
||||||
pub blockstore_advanced_options: BlockstoreAdvancedOptions,
|
pub ledger_column_options: LedgerColumnOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ValidatorConfig {
|
impl Default for ValidatorConfig {
|
||||||
|
@ -230,7 +230,7 @@ impl Default for ValidatorConfig {
|
||||||
accounts_shrink_ratio: AccountShrinkThreshold::default(),
|
accounts_shrink_ratio: AccountShrinkThreshold::default(),
|
||||||
accounts_db_config: None,
|
accounts_db_config: None,
|
||||||
wait_to_vote_slot: None,
|
wait_to_vote_slot: None,
|
||||||
blockstore_advanced_options: BlockstoreAdvancedOptions::default(),
|
ledger_column_options: LedgerColumnOptions::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1297,7 +1297,7 @@ fn load_blockstore(
|
||||||
ledger_path,
|
ledger_path,
|
||||||
BlockstoreOptions {
|
BlockstoreOptions {
|
||||||
recovery_mode: config.wal_recovery_mode.clone(),
|
recovery_mode: config.wal_recovery_mode.clone(),
|
||||||
advanced_options: config.blockstore_advanced_options.clone(),
|
column_options: config.ledger_column_options.clone(),
|
||||||
..BlockstoreOptions::default()
|
..BlockstoreOptions::default()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,7 @@ mod tests {
|
||||||
solana_ledger::{
|
solana_ledger::{
|
||||||
blockstore::{make_many_slot_shreds, Blockstore},
|
blockstore::{make_many_slot_shreds, Blockstore},
|
||||||
blockstore_db::{
|
blockstore_db::{
|
||||||
BlockstoreAdvancedOptions, BlockstoreOptions, BlockstoreRocksFifoOptions,
|
BlockstoreOptions, BlockstoreRocksFifoOptions, LedgerColumnOptions,
|
||||||
ShredStorageType,
|
ShredStorageType,
|
||||||
},
|
},
|
||||||
get_tmp_ledger_path,
|
get_tmp_ledger_path,
|
||||||
|
@ -351,7 +351,7 @@ mod tests {
|
||||||
&ledger_path,
|
&ledger_path,
|
||||||
if config.fifo_compaction {
|
if config.fifo_compaction {
|
||||||
BlockstoreOptions {
|
BlockstoreOptions {
|
||||||
advanced_options: BlockstoreAdvancedOptions {
|
column_options: LedgerColumnOptions {
|
||||||
shred_storage_type: ShredStorageType::RocksFifo(
|
shred_storage_type: ShredStorageType::RocksFifo(
|
||||||
BlockstoreRocksFifoOptions {
|
BlockstoreRocksFifoOptions {
|
||||||
shred_data_cf_size: config.shred_data_cf_size,
|
shred_data_cf_size: config.shred_data_cf_size,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use {
|
||||||
},
|
},
|
||||||
solana_entry::poh::compute_hashes_per_tick,
|
solana_entry::poh::compute_hashes_per_tick,
|
||||||
solana_genesis::{genesis_accounts::add_genesis_accounts, Base64Account},
|
solana_genesis::{genesis_accounts::add_genesis_accounts, Base64Account},
|
||||||
solana_ledger::{blockstore::create_new_ledger, blockstore_db::BlockstoreAdvancedOptions},
|
solana_ledger::{blockstore::create_new_ledger, blockstore_db::LedgerColumnOptions},
|
||||||
solana_runtime::hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
solana_runtime::hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
|
account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
|
||||||
|
@ -629,7 +629,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
|
||||||
&ledger_path,
|
&ledger_path,
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
max_genesis_archive_unpacked_size,
|
max_genesis_archive_unpacked_size,
|
||||||
BlockstoreAdvancedOptions::default(),
|
LedgerColumnOptions::default(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
println!("{}", genesis_config);
|
println!("{}", genesis_config);
|
||||||
|
|
|
@ -25,8 +25,8 @@ use {
|
||||||
bank_forks_utils,
|
bank_forks_utils,
|
||||||
blockstore::{create_new_ledger, Blockstore, PurgeType},
|
blockstore::{create_new_ledger, Blockstore, PurgeType},
|
||||||
blockstore_db::{
|
blockstore_db::{
|
||||||
self, AccessType, BlockstoreAdvancedOptions, BlockstoreOptions, BlockstoreRecoveryMode,
|
self, AccessType, BlockstoreOptions, BlockstoreRecoveryMode, Database,
|
||||||
Database,
|
LedgerColumnOptions,
|
||||||
},
|
},
|
||||||
blockstore_processor::{BlockstoreProcessorError, ProcessOptions},
|
blockstore_processor::{BlockstoreProcessorError, ProcessOptions},
|
||||||
shred::Shred,
|
shred::Shred,
|
||||||
|
@ -1719,7 +1719,7 @@ fn main() {
|
||||||
&output_directory,
|
&output_directory,
|
||||||
&genesis_config,
|
&genesis_config,
|
||||||
solana_runtime::hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
solana_runtime::hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
||||||
BlockstoreAdvancedOptions::default(),
|
LedgerColumnOptions::default(),
|
||||||
)
|
)
|
||||||
.unwrap_or_else(|err| {
|
.unwrap_or_else(|err| {
|
||||||
eprintln!("Failed to write genesis config: {:?}", err);
|
eprintln!("Failed to write genesis config: {:?}", err);
|
||||||
|
|
|
@ -5,8 +5,8 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
ancestor_iterator::AncestorIterator,
|
ancestor_iterator::AncestorIterator,
|
||||||
blockstore_db::{
|
blockstore_db::{
|
||||||
columns as cf, AccessType, BlockstoreAdvancedOptions, BlockstoreOptions, Column,
|
columns as cf, AccessType, BlockstoreOptions, Column, ColumnName, Database,
|
||||||
ColumnName, Database, IteratorDirection, IteratorMode, LedgerColumn, Result,
|
IteratorDirection, IteratorMode, LedgerColumn, LedgerColumnOptions, Result,
|
||||||
ShredStorageType, WriteBatch,
|
ShredStorageType, WriteBatch,
|
||||||
},
|
},
|
||||||
blockstore_meta::*,
|
blockstore_meta::*,
|
||||||
|
@ -178,7 +178,7 @@ pub struct Blockstore {
|
||||||
pub lowest_cleanup_slot: RwLock<Slot>,
|
pub lowest_cleanup_slot: RwLock<Slot>,
|
||||||
no_compaction: bool,
|
no_compaction: bool,
|
||||||
slots_stats: Mutex<SlotsStats>,
|
slots_stats: Mutex<SlotsStats>,
|
||||||
advanced_options: BlockstoreAdvancedOptions,
|
column_options: LedgerColumnOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SlotsStats {
|
struct SlotsStats {
|
||||||
|
@ -521,8 +521,8 @@ impl BlockstoreRocksDbColumnFamilyMetrics {
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! rocksdb_metric_header {
|
macro_rules! rocksdb_metric_header {
|
||||||
($metric_name:literal, $cf_name:literal, $advanced_options:expr) => {
|
($metric_name:literal, $cf_name:literal, $column_options:expr) => {
|
||||||
match $advanced_options.shred_storage_type {
|
match $column_options.shred_storage_type {
|
||||||
ShredStorageType::RocksLevel =>
|
ShredStorageType::RocksLevel =>
|
||||||
rocksdb_metric_header!(@all_fields $metric_name, $cf_name, "rocks_level"),
|
rocksdb_metric_header!(@all_fields $metric_name, $cf_name, "rocks_level"),
|
||||||
ShredStorageType::RocksFifo(_) =>
|
ShredStorageType::RocksFifo(_) =>
|
||||||
|
@ -569,9 +569,9 @@ impl Blockstore {
|
||||||
fn do_open(ledger_path: &Path, options: BlockstoreOptions) -> Result<Blockstore> {
|
fn do_open(ledger_path: &Path, options: BlockstoreOptions) -> Result<Blockstore> {
|
||||||
fs::create_dir_all(&ledger_path)?;
|
fs::create_dir_all(&ledger_path)?;
|
||||||
let blockstore_path = ledger_path.join(Self::blockstore_directory(
|
let blockstore_path = ledger_path.join(Self::blockstore_directory(
|
||||||
&options.advanced_options.shred_storage_type,
|
&options.column_options.shred_storage_type,
|
||||||
));
|
));
|
||||||
let advanced_options = options.advanced_options.clone();
|
let column_options = options.column_options.clone();
|
||||||
|
|
||||||
adjust_ulimit_nofile(options.enforce_ulimit_nofile)?;
|
adjust_ulimit_nofile(options.enforce_ulimit_nofile)?;
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ impl Blockstore {
|
||||||
lowest_cleanup_slot: RwLock::<Slot>::default(),
|
lowest_cleanup_slot: RwLock::<Slot>::default(),
|
||||||
no_compaction: false,
|
no_compaction: false,
|
||||||
slots_stats: Mutex::<SlotsStats>::default(),
|
slots_stats: Mutex::<SlotsStats>::default(),
|
||||||
advanced_options,
|
column_options,
|
||||||
};
|
};
|
||||||
if initialize_transaction_status_index {
|
if initialize_transaction_status_index {
|
||||||
blockstore.initialize_transaction_status_index()?;
|
blockstore.initialize_transaction_status_index()?;
|
||||||
|
@ -961,101 +961,101 @@ impl Blockstore {
|
||||||
/// Collects and reports [`BlockstoreRocksDbColumnFamilyMetrics`] for the
|
/// Collects and reports [`BlockstoreRocksDbColumnFamilyMetrics`] for the
|
||||||
/// all the column families.
|
/// all the column families.
|
||||||
pub fn submit_rocksdb_cf_metrics_for_all_cfs(&self) {
|
pub fn submit_rocksdb_cf_metrics_for_all_cfs(&self) {
|
||||||
let advanced_options = &self.advanced_options;
|
let column_options = &self.column_options;
|
||||||
self.submit_rocksdb_cf_metrics::<cf::SlotMeta>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::SlotMeta>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"slot_meta",
|
"slot_meta",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::DeadSlots>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::DeadSlots>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"dead_slots",
|
"dead_slots",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::DuplicateSlots>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::DuplicateSlots>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"duplicate_slots",
|
"duplicate_slots",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::ErasureMeta>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::ErasureMeta>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"erasure_meta",
|
"erasure_meta",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::Orphans>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::Orphans>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"orphans",
|
"orphans",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::BankHash>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::BankHash>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"bank_hash",
|
"bank_hash",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::Root>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::Root>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"root",
|
"root",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::Index>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::Index>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"index",
|
"index",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::ShredData>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::ShredData>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"shred_data",
|
"shred_data",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::ShredCode>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::ShredCode>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"shred_code",
|
"shred_code",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::TransactionStatus>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::TransactionStatus>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"transaction_status",
|
"transaction_status",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::AddressSignatures>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::AddressSignatures>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"address_signature",
|
"address_signature",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::TransactionMemos>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::TransactionMemos>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"transaction_memos",
|
"transaction_memos",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::TransactionStatusIndex>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::TransactionStatusIndex>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"transaction_status_index",
|
"transaction_status_index",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::Rewards>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::Rewards>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"rewards",
|
"rewards",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::Blocktime>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::Blocktime>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"blocktime",
|
"blocktime",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::PerfSamples>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::PerfSamples>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"perf_sample",
|
"perf_sample",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::BlockHeight>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::BlockHeight>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"block_height",
|
"block_height",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
self.submit_rocksdb_cf_metrics::<cf::ProgramCosts>(rocksdb_metric_header!(
|
self.submit_rocksdb_cf_metrics::<cf::ProgramCosts>(rocksdb_metric_header!(
|
||||||
"blockstore_rocksdb_cfs",
|
"blockstore_rocksdb_cfs",
|
||||||
"program_costs",
|
"program_costs",
|
||||||
advanced_options
|
column_options
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4150,20 +4150,20 @@ pub fn create_new_ledger(
|
||||||
ledger_path: &Path,
|
ledger_path: &Path,
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
max_genesis_archive_unpacked_size: u64,
|
max_genesis_archive_unpacked_size: u64,
|
||||||
advanced_options: BlockstoreAdvancedOptions,
|
column_options: LedgerColumnOptions,
|
||||||
) -> Result<Hash> {
|
) -> Result<Hash> {
|
||||||
Blockstore::destroy(ledger_path)?;
|
Blockstore::destroy(ledger_path)?;
|
||||||
genesis_config.write(ledger_path)?;
|
genesis_config.write(ledger_path)?;
|
||||||
|
|
||||||
// Fill slot 0 with ticks that link back to the genesis_config to bootstrap the ledger.
|
// Fill slot 0 with ticks that link back to the genesis_config to bootstrap the ledger.
|
||||||
let blockstore_dir = Blockstore::blockstore_directory(&advanced_options.shred_storage_type);
|
let blockstore_dir = Blockstore::blockstore_directory(&column_options.shred_storage_type);
|
||||||
let blockstore = Blockstore::open_with_options(
|
let blockstore = Blockstore::open_with_options(
|
||||||
ledger_path,
|
ledger_path,
|
||||||
BlockstoreOptions {
|
BlockstoreOptions {
|
||||||
access_type: AccessType::PrimaryOnly,
|
access_type: AccessType::PrimaryOnly,
|
||||||
recovery_mode: None,
|
recovery_mode: None,
|
||||||
enforce_ulimit_nofile: false,
|
enforce_ulimit_nofile: false,
|
||||||
advanced_options: advanced_options.clone(),
|
column_options: column_options.clone(),
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
let ticks_per_slot = genesis_config.ticks_per_slot;
|
let ticks_per_slot = genesis_config.ticks_per_slot;
|
||||||
|
@ -4332,7 +4332,7 @@ macro_rules! create_new_tmp_ledger {
|
||||||
$crate::blockstore::create_new_ledger_from_name(
|
$crate::blockstore::create_new_ledger_from_name(
|
||||||
$crate::tmp_ledger_name!(),
|
$crate::tmp_ledger_name!(),
|
||||||
$genesis_config,
|
$genesis_config,
|
||||||
$crate::blockstore_db::BlockstoreAdvancedOptions::default(),
|
$crate::blockstore_db::LedgerColumnOptions::default(),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4343,7 +4343,7 @@ macro_rules! create_new_tmp_ledger_auto_delete {
|
||||||
$crate::blockstore::create_new_ledger_from_name_auto_delete(
|
$crate::blockstore::create_new_ledger_from_name_auto_delete(
|
||||||
$crate::tmp_ledger_name!(),
|
$crate::tmp_ledger_name!(),
|
||||||
$genesis_config,
|
$genesis_config,
|
||||||
$crate::blockstore_db::BlockstoreAdvancedOptions::default(),
|
$crate::blockstore_db::LedgerColumnOptions::default(),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4354,7 +4354,7 @@ macro_rules! create_new_tmp_ledger_fifo_auto_delete {
|
||||||
$crate::blockstore::create_new_ledger_from_name_auto_delete(
|
$crate::blockstore::create_new_ledger_from_name_auto_delete(
|
||||||
$crate::tmp_ledger_name!(),
|
$crate::tmp_ledger_name!(),
|
||||||
$genesis_config,
|
$genesis_config,
|
||||||
$crate::blockstore_db::BlockstoreAdvancedOptions {
|
$crate::blockstore_db::LedgerColumnOptions {
|
||||||
shred_storage_type: $crate::blockstore_db::ShredStorageType::RocksFifo(
|
shred_storage_type: $crate::blockstore_db::ShredStorageType::RocksFifo(
|
||||||
$crate::blockstore_db::BlockstoreRocksFifoOptions::default(),
|
$crate::blockstore_db::BlockstoreRocksFifoOptions::default(),
|
||||||
),
|
),
|
||||||
|
@ -4388,10 +4388,10 @@ pub fn verify_shred_slots(slot: Slot, parent_slot: Slot, last_root: Slot) -> boo
|
||||||
pub fn create_new_ledger_from_name(
|
pub fn create_new_ledger_from_name(
|
||||||
name: &str,
|
name: &str,
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
advanced_options: BlockstoreAdvancedOptions,
|
column_options: LedgerColumnOptions,
|
||||||
) -> (PathBuf, Hash) {
|
) -> (PathBuf, Hash) {
|
||||||
let (ledger_path, blockhash) =
|
let (ledger_path, blockhash) =
|
||||||
create_new_ledger_from_name_auto_delete(name, genesis_config, advanced_options);
|
create_new_ledger_from_name_auto_delete(name, genesis_config, column_options);
|
||||||
(ledger_path.into_path(), blockhash)
|
(ledger_path.into_path(), blockhash)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4402,14 +4402,14 @@ pub fn create_new_ledger_from_name(
|
||||||
pub fn create_new_ledger_from_name_auto_delete(
|
pub fn create_new_ledger_from_name_auto_delete(
|
||||||
name: &str,
|
name: &str,
|
||||||
genesis_config: &GenesisConfig,
|
genesis_config: &GenesisConfig,
|
||||||
advanced_options: BlockstoreAdvancedOptions,
|
column_options: LedgerColumnOptions,
|
||||||
) -> (TempDir, Hash) {
|
) -> (TempDir, Hash) {
|
||||||
let ledger_path = get_ledger_path_from_name_auto_delete(name);
|
let ledger_path = get_ledger_path_from_name_auto_delete(name);
|
||||||
let blockhash = create_new_ledger(
|
let blockhash = create_new_ledger(
|
||||||
ledger_path.path(),
|
ledger_path.path(),
|
||||||
genesis_config,
|
genesis_config,
|
||||||
MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
MAX_GENESIS_ARCHIVE_UNPACKED_SIZE,
|
||||||
advanced_options,
|
column_options,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
(ledger_path, blockhash)
|
(ledger_path, blockhash)
|
||||||
|
@ -4718,7 +4718,7 @@ pub mod tests {
|
||||||
let blockstore = Blockstore::open_with_options(
|
let blockstore = Blockstore::open_with_options(
|
||||||
ledger_path.path(),
|
ledger_path.path(),
|
||||||
BlockstoreOptions {
|
BlockstoreOptions {
|
||||||
advanced_options: BlockstoreAdvancedOptions {
|
column_options: LedgerColumnOptions {
|
||||||
shred_storage_type: ShredStorageType::RocksFifo(
|
shred_storage_type: ShredStorageType::RocksFifo(
|
||||||
BlockstoreRocksFifoOptions::default(),
|
BlockstoreRocksFifoOptions::default(),
|
||||||
),
|
),
|
||||||
|
|
|
@ -991,16 +991,16 @@ impl Default for ShredStorageType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Advanced options for blockstore.
|
/// Options for LedgerColumn.
|
||||||
/// The each advanced option might also be used as a tag that supports
|
/// Each field might also be used as a tag that supports group-by operation when
|
||||||
/// group-by operation when reporting Blockstore metrics.
|
/// reporting metrics.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct BlockstoreAdvancedOptions {
|
pub struct LedgerColumnOptions {
|
||||||
// Determine how to store both data and coding shreds. Default: RocksLevel.
|
// Determine how to store both data and coding shreds. Default: RocksLevel.
|
||||||
pub shred_storage_type: ShredStorageType,
|
pub shred_storage_type: ShredStorageType,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BlockstoreAdvancedOptions {
|
impl Default for LedgerColumnOptions {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
shred_storage_type: ShredStorageType::RocksLevel,
|
shred_storage_type: ShredStorageType::RocksLevel,
|
||||||
|
@ -1015,7 +1015,7 @@ pub struct BlockstoreOptions {
|
||||||
pub recovery_mode: Option<BlockstoreRecoveryMode>,
|
pub recovery_mode: Option<BlockstoreRecoveryMode>,
|
||||||
// Whether to allow unlimited number of open files. Default: true.
|
// Whether to allow unlimited number of open files. Default: true.
|
||||||
pub enforce_ulimit_nofile: bool,
|
pub enforce_ulimit_nofile: bool,
|
||||||
pub advanced_options: BlockstoreAdvancedOptions,
|
pub column_options: LedgerColumnOptions,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BlockstoreOptions {
|
impl Default for BlockstoreOptions {
|
||||||
|
@ -1025,7 +1025,7 @@ impl Default for BlockstoreOptions {
|
||||||
access_type: AccessType::PrimaryOnly,
|
access_type: AccessType::PrimaryOnly,
|
||||||
recovery_mode: None,
|
recovery_mode: None,
|
||||||
enforce_ulimit_nofile: true,
|
enforce_ulimit_nofile: true,
|
||||||
advanced_options: BlockstoreAdvancedOptions::default(),
|
column_options: LedgerColumnOptions::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1459,7 +1459,7 @@ fn new_cf_descriptor_pair_shreds<
|
||||||
options: &BlockstoreOptions,
|
options: &BlockstoreOptions,
|
||||||
oldest_slot: &OldestSlot,
|
oldest_slot: &OldestSlot,
|
||||||
) -> (ColumnFamilyDescriptor, ColumnFamilyDescriptor) {
|
) -> (ColumnFamilyDescriptor, ColumnFamilyDescriptor) {
|
||||||
match &options.advanced_options.shred_storage_type {
|
match &options.column_options.shred_storage_type {
|
||||||
ShredStorageType::RocksLevel => (
|
ShredStorageType::RocksLevel => (
|
||||||
new_cf_descriptor::<D>(options, oldest_slot),
|
new_cf_descriptor::<D>(options, oldest_slot),
|
||||||
new_cf_descriptor::<C>(options, oldest_slot),
|
new_cf_descriptor::<C>(options, oldest_slot),
|
||||||
|
|
|
@ -63,7 +63,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
|
||||||
accounts_shrink_ratio: config.accounts_shrink_ratio,
|
accounts_shrink_ratio: config.accounts_shrink_ratio,
|
||||||
accounts_db_config: config.accounts_db_config.clone(),
|
accounts_db_config: config.accounts_db_config.clone(),
|
||||||
wait_to_vote_slot: config.wait_to_vote_slot,
|
wait_to_vote_slot: config.wait_to_vote_slot,
|
||||||
blockstore_advanced_options: config.blockstore_advanced_options.clone(),
|
ledger_column_options: config.ledger_column_options.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@ use {
|
||||||
socketaddr,
|
socketaddr,
|
||||||
},
|
},
|
||||||
solana_ledger::{
|
solana_ledger::{
|
||||||
blockstore::create_new_ledger, blockstore_db::BlockstoreAdvancedOptions,
|
blockstore::create_new_ledger, blockstore_db::LedgerColumnOptions, create_new_tmp_ledger,
|
||||||
create_new_tmp_ledger,
|
|
||||||
},
|
},
|
||||||
solana_net_utils::PortRange,
|
solana_net_utils::PortRange,
|
||||||
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
|
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
|
||||||
|
@ -582,7 +581,7 @@ impl TestValidator {
|
||||||
config
|
config
|
||||||
.max_genesis_archive_unpacked_size
|
.max_genesis_archive_unpacked_size
|
||||||
.unwrap_or(MAX_GENESIS_ARCHIVE_UNPACKED_SIZE),
|
.unwrap_or(MAX_GENESIS_ARCHIVE_UNPACKED_SIZE),
|
||||||
BlockstoreAdvancedOptions::default(),
|
LedgerColumnOptions::default(),
|
||||||
)
|
)
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
format!(
|
format!(
|
||||||
|
|
|
@ -33,8 +33,8 @@ use {
|
||||||
contact_info::ContactInfo,
|
contact_info::ContactInfo,
|
||||||
},
|
},
|
||||||
solana_ledger::blockstore_db::{
|
solana_ledger::blockstore_db::{
|
||||||
BlockstoreAdvancedOptions, BlockstoreRecoveryMode, BlockstoreRocksFifoOptions,
|
BlockstoreRecoveryMode, BlockstoreRocksFifoOptions, LedgerColumnOptions, ShredStorageType,
|
||||||
ShredStorageType, DEFAULT_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES,
|
DEFAULT_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES,
|
||||||
},
|
},
|
||||||
solana_perf::recycler::enable_recycler_warming,
|
solana_perf::recycler::enable_recycler_warming,
|
||||||
solana_poh::poh_service,
|
solana_poh::poh_service,
|
||||||
|
@ -2567,7 +2567,7 @@ pub fn main() {
|
||||||
validator_config.max_ledger_shreds = Some(limit_ledger_size);
|
validator_config.max_ledger_shreds = Some(limit_ledger_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
validator_config.blockstore_advanced_options = BlockstoreAdvancedOptions {
|
validator_config.ledger_column_options = LedgerColumnOptions {
|
||||||
shred_storage_type: match matches.value_of("rocksdb_shred_compaction") {
|
shred_storage_type: match matches.value_of("rocksdb_shred_compaction") {
|
||||||
None => ShredStorageType::default(),
|
None => ShredStorageType::default(),
|
||||||
Some(shred_compaction_string) => match shred_compaction_string {
|
Some(shred_compaction_string) => match shred_compaction_string {
|
||||||
|
|
Loading…
Reference in New Issue