Remove the const default for RocksFifo (#27965)
#### Summary of Changes Removes the constant default for ShredStorageType::RocksFifo as the shred storage size is either user-specified or derived from --limit-ledger-size in #27459.
This commit is contained in:
parent
10db560278
commit
6b17bee5a8
|
@ -355,7 +355,7 @@ mod tests {
|
|||
shred_storage_type: ShredStorageType::RocksFifo(
|
||||
BlockstoreRocksFifoOptions {
|
||||
shred_data_cf_size: config.shred_data_cf_size,
|
||||
..BlockstoreRocksFifoOptions::default()
|
||||
shred_code_cf_size: config.shred_data_cf_size,
|
||||
},
|
||||
),
|
||||
..LedgerColumnOptions::default()
|
||||
|
|
|
@ -31,8 +31,9 @@ use {
|
|||
blockstore::{create_new_ledger, Blockstore, BlockstoreError, PurgeType},
|
||||
blockstore_db::{self, columns as cf, Column, ColumnName, Database},
|
||||
blockstore_options::{
|
||||
AccessType, BlockstoreOptions, BlockstoreRecoveryMode, BlockstoreRocksFifoOptions,
|
||||
LedgerColumnOptions, ShredStorageType, MAX_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES,
|
||||
AccessType, BlockstoreOptions, BlockstoreRecoveryMode, LedgerColumnOptions,
|
||||
ShredStorageType, BLOCKSTORE_DIRECTORY_ROCKS_FIFO,
|
||||
MAX_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES,
|
||||
},
|
||||
blockstore_processor::{self, BlockstoreProcessorError, ProcessOptions},
|
||||
shred::Shred,
|
||||
|
@ -2310,8 +2311,7 @@ fn main() {
|
|||
the default RocksLevel will be used. \
|
||||
If you want to use FIFO shred_storage_type on an empty target_db, \
|
||||
create {} foldar the specified target_db directory.",
|
||||
ShredStorageType::RocksFifo(BlockstoreRocksFifoOptions::default())
|
||||
.blockstore_directory()
|
||||
BLOCKSTORE_DIRECTORY_ROCKS_FIFO,
|
||||
),
|
||||
);
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ use {
|
|||
},
|
||||
blockstore_meta::*,
|
||||
blockstore_options::{
|
||||
AccessType, BlockstoreOptions, BlockstoreRocksFifoOptions, LedgerColumnOptions,
|
||||
ShredStorageType,
|
||||
AccessType, BlockstoreOptions, LedgerColumnOptions, BLOCKSTORE_DIRECTORY_ROCKS_FIFO,
|
||||
BLOCKSTORE_DIRECTORY_ROCKS_LEVEL,
|
||||
},
|
||||
leader_schedule_cache::LeaderScheduleCache,
|
||||
next_slots_iterator::NextSlotsIterator,
|
||||
|
@ -429,15 +429,9 @@ impl Blockstore {
|
|||
pub fn destroy(ledger_path: &Path) -> Result<()> {
|
||||
// Database::destroy() fails if the root directory doesn't exist
|
||||
fs::create_dir_all(ledger_path)?;
|
||||
Database::destroy(
|
||||
&Path::new(ledger_path).join(ShredStorageType::RocksLevel.blockstore_directory()),
|
||||
Database::destroy(&Path::new(ledger_path).join(BLOCKSTORE_DIRECTORY_ROCKS_LEVEL)).and(
|
||||
Database::destroy(&Path::new(ledger_path).join(BLOCKSTORE_DIRECTORY_ROCKS_FIFO)),
|
||||
)
|
||||
.and(Database::destroy(
|
||||
&Path::new(ledger_path).join(
|
||||
ShredStorageType::RocksFifo(BlockstoreRocksFifoOptions::default())
|
||||
.blockstore_directory(),
|
||||
),
|
||||
))
|
||||
}
|
||||
|
||||
/// Returns the SlotMeta of the specified slot.
|
||||
|
@ -4062,7 +4056,7 @@ macro_rules! create_new_tmp_ledger_fifo {
|
|||
$genesis_config,
|
||||
$crate::blockstore_options::LedgerColumnOptions {
|
||||
shred_storage_type: $crate::blockstore_options::ShredStorageType::RocksFifo(
|
||||
$crate::blockstore_options::BlockstoreRocksFifoOptions::default(),
|
||||
$crate::blockstore_options::BlockstoreRocksFifoOptions::new_for_tests(),
|
||||
),
|
||||
..$crate::blockstore_options::LedgerColumnOptions::default()
|
||||
},
|
||||
|
@ -4089,7 +4083,7 @@ macro_rules! create_new_tmp_ledger_fifo_auto_delete {
|
|||
$genesis_config,
|
||||
$crate::blockstore_options::LedgerColumnOptions {
|
||||
shred_storage_type: $crate::blockstore_options::ShredStorageType::RocksFifo(
|
||||
$crate::blockstore_options::BlockstoreRocksFifoOptions::default(),
|
||||
$crate::blockstore_options::BlockstoreRocksFifoOptions::new_for_tests(),
|
||||
),
|
||||
..$crate::blockstore_options::LedgerColumnOptions::default()
|
||||
},
|
||||
|
@ -4389,7 +4383,7 @@ pub mod tests {
|
|||
use {
|
||||
super::*,
|
||||
crate::{
|
||||
blockstore_options::BlockstoreRocksFifoOptions,
|
||||
blockstore_options::{BlockstoreRocksFifoOptions, ShredStorageType},
|
||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||
leader_schedule::{FixedSchedule, LeaderSchedule},
|
||||
shred::{max_ticks_per_n_shreds, ShredFlags},
|
||||
|
@ -4463,7 +4457,7 @@ pub mod tests {
|
|||
|
||||
assert_eq!(ticks, entries);
|
||||
assert!(Path::new(ledger_path.path())
|
||||
.join(ShredStorageType::RocksLevel.blockstore_directory())
|
||||
.join(BLOCKSTORE_DIRECTORY_ROCKS_LEVEL)
|
||||
.exists());
|
||||
}
|
||||
|
||||
|
@ -4478,7 +4472,7 @@ pub mod tests {
|
|||
BlockstoreOptions {
|
||||
column_options: LedgerColumnOptions {
|
||||
shred_storage_type: ShredStorageType::RocksFifo(
|
||||
BlockstoreRocksFifoOptions::default(),
|
||||
BlockstoreRocksFifoOptions::new_for_tests(),
|
||||
),
|
||||
..LedgerColumnOptions::default()
|
||||
},
|
||||
|
@ -4492,10 +4486,7 @@ pub mod tests {
|
|||
|
||||
assert_eq!(ticks, entries);
|
||||
assert!(Path::new(ledger_path.path())
|
||||
.join(
|
||||
ShredStorageType::RocksFifo(BlockstoreRocksFifoOptions::default())
|
||||
.blockstore_directory()
|
||||
)
|
||||
.join(BLOCKSTORE_DIRECTORY_ROCKS_FIFO)
|
||||
.exists());
|
||||
}
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ impl Default for ShredStorageType {
|
|||
}
|
||||
}
|
||||
|
||||
const BLOCKSTORE_DIRECTORY_ROCKS_LEVEL: &str = "rocksdb";
|
||||
const BLOCKSTORE_DIRECTORY_ROCKS_FIFO: &str = "rocksdb_fifo";
|
||||
pub const BLOCKSTORE_DIRECTORY_ROCKS_LEVEL: &str = "rocksdb";
|
||||
pub const BLOCKSTORE_DIRECTORY_ROCKS_FIFO: &str = "rocksdb_fifo";
|
||||
|
||||
impl ShredStorageType {
|
||||
/// Returns ShredStorageType::RocksFifo where the specified
|
||||
|
@ -212,19 +212,8 @@ pub struct BlockstoreRocksFifoOptions {
|
|||
pub shred_code_cf_size: u64,
|
||||
}
|
||||
|
||||
// The default storage size for storing shreds when `rocksdb-shred-compaction`
|
||||
// is set to `fifo` in the validator arguments. This amount of storage size
|
||||
// in bytes will equally allocated to both data shreds and coding shreds.
|
||||
pub const DEFAULT_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES: u64 = 250 * 1024 * 1024 * 1024;
|
||||
|
||||
pub const MAX_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES: u64 = std::u64::MAX;
|
||||
|
||||
impl Default for BlockstoreRocksFifoOptions {
|
||||
fn default() -> Self {
|
||||
BlockstoreRocksFifoOptions::new(DEFAULT_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES)
|
||||
}
|
||||
}
|
||||
|
||||
impl BlockstoreRocksFifoOptions {
|
||||
fn new(shred_storage_size: u64) -> Self {
|
||||
Self {
|
||||
|
@ -232,6 +221,13 @@ impl BlockstoreRocksFifoOptions {
|
|||
shred_code_cf_size: shred_storage_size / 2,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_for_tests() -> Self {
|
||||
Self {
|
||||
shred_data_cf_size: 150_000_000_000,
|
||||
shred_code_cf_size: 150_000_000_000,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -266,7 +262,11 @@ fn test_rocksdb_directory() {
|
|||
BLOCKSTORE_DIRECTORY_ROCKS_LEVEL
|
||||
);
|
||||
assert_eq!(
|
||||
ShredStorageType::RocksFifo(BlockstoreRocksFifoOptions::default()).blockstore_directory(),
|
||||
ShredStorageType::RocksFifo(BlockstoreRocksFifoOptions {
|
||||
shred_code_cf_size: 0,
|
||||
shred_data_cf_size: 0
|
||||
})
|
||||
.blockstore_directory(),
|
||||
BLOCKSTORE_DIRECTORY_ROCKS_FIFO
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue