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(
|
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,
|
||||||
..BlockstoreRocksFifoOptions::default()
|
shred_code_cf_size: config.shred_data_cf_size,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
..LedgerColumnOptions::default()
|
..LedgerColumnOptions::default()
|
||||||
|
|
|
@ -31,8 +31,9 @@ use {
|
||||||
blockstore::{create_new_ledger, Blockstore, BlockstoreError, PurgeType},
|
blockstore::{create_new_ledger, Blockstore, BlockstoreError, PurgeType},
|
||||||
blockstore_db::{self, columns as cf, Column, ColumnName, Database},
|
blockstore_db::{self, columns as cf, Column, ColumnName, Database},
|
||||||
blockstore_options::{
|
blockstore_options::{
|
||||||
AccessType, BlockstoreOptions, BlockstoreRecoveryMode, BlockstoreRocksFifoOptions,
|
AccessType, BlockstoreOptions, BlockstoreRecoveryMode, LedgerColumnOptions,
|
||||||
LedgerColumnOptions, ShredStorageType, MAX_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES,
|
ShredStorageType, BLOCKSTORE_DIRECTORY_ROCKS_FIFO,
|
||||||
|
MAX_ROCKS_FIFO_SHRED_STORAGE_SIZE_BYTES,
|
||||||
},
|
},
|
||||||
blockstore_processor::{self, BlockstoreProcessorError, ProcessOptions},
|
blockstore_processor::{self, BlockstoreProcessorError, ProcessOptions},
|
||||||
shred::Shred,
|
shred::Shred,
|
||||||
|
@ -2310,8 +2311,7 @@ fn main() {
|
||||||
the default RocksLevel will be used. \
|
the default RocksLevel will be used. \
|
||||||
If you want to use FIFO shred_storage_type on an empty target_db, \
|
If you want to use FIFO shred_storage_type on an empty target_db, \
|
||||||
create {} foldar the specified target_db directory.",
|
create {} foldar the specified target_db directory.",
|
||||||
ShredStorageType::RocksFifo(BlockstoreRocksFifoOptions::default())
|
BLOCKSTORE_DIRECTORY_ROCKS_FIFO,
|
||||||
.blockstore_directory()
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ use {
|
||||||
},
|
},
|
||||||
blockstore_meta::*,
|
blockstore_meta::*,
|
||||||
blockstore_options::{
|
blockstore_options::{
|
||||||
AccessType, BlockstoreOptions, BlockstoreRocksFifoOptions, LedgerColumnOptions,
|
AccessType, BlockstoreOptions, LedgerColumnOptions, BLOCKSTORE_DIRECTORY_ROCKS_FIFO,
|
||||||
ShredStorageType,
|
BLOCKSTORE_DIRECTORY_ROCKS_LEVEL,
|
||||||
},
|
},
|
||||||
leader_schedule_cache::LeaderScheduleCache,
|
leader_schedule_cache::LeaderScheduleCache,
|
||||||
next_slots_iterator::NextSlotsIterator,
|
next_slots_iterator::NextSlotsIterator,
|
||||||
|
@ -429,15 +429,9 @@ impl Blockstore {
|
||||||
pub fn destroy(ledger_path: &Path) -> Result<()> {
|
pub fn destroy(ledger_path: &Path) -> Result<()> {
|
||||||
// Database::destroy() fails if the root directory doesn't exist
|
// Database::destroy() fails if the root directory doesn't exist
|
||||||
fs::create_dir_all(ledger_path)?;
|
fs::create_dir_all(ledger_path)?;
|
||||||
Database::destroy(
|
Database::destroy(&Path::new(ledger_path).join(BLOCKSTORE_DIRECTORY_ROCKS_LEVEL)).and(
|
||||||
&Path::new(ledger_path).join(ShredStorageType::RocksLevel.blockstore_directory()),
|
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.
|
/// Returns the SlotMeta of the specified slot.
|
||||||
|
@ -4062,7 +4056,7 @@ macro_rules! create_new_tmp_ledger_fifo {
|
||||||
$genesis_config,
|
$genesis_config,
|
||||||
$crate::blockstore_options::LedgerColumnOptions {
|
$crate::blockstore_options::LedgerColumnOptions {
|
||||||
shred_storage_type: $crate::blockstore_options::ShredStorageType::RocksFifo(
|
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()
|
..$crate::blockstore_options::LedgerColumnOptions::default()
|
||||||
},
|
},
|
||||||
|
@ -4089,7 +4083,7 @@ macro_rules! create_new_tmp_ledger_fifo_auto_delete {
|
||||||
$genesis_config,
|
$genesis_config,
|
||||||
$crate::blockstore_options::LedgerColumnOptions {
|
$crate::blockstore_options::LedgerColumnOptions {
|
||||||
shred_storage_type: $crate::blockstore_options::ShredStorageType::RocksFifo(
|
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()
|
..$crate::blockstore_options::LedgerColumnOptions::default()
|
||||||
},
|
},
|
||||||
|
@ -4389,7 +4383,7 @@ pub mod tests {
|
||||||
use {
|
use {
|
||||||
super::*,
|
super::*,
|
||||||
crate::{
|
crate::{
|
||||||
blockstore_options::BlockstoreRocksFifoOptions,
|
blockstore_options::{BlockstoreRocksFifoOptions, ShredStorageType},
|
||||||
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
genesis_utils::{create_genesis_config, GenesisConfigInfo},
|
||||||
leader_schedule::{FixedSchedule, LeaderSchedule},
|
leader_schedule::{FixedSchedule, LeaderSchedule},
|
||||||
shred::{max_ticks_per_n_shreds, ShredFlags},
|
shred::{max_ticks_per_n_shreds, ShredFlags},
|
||||||
|
@ -4463,7 +4457,7 @@ pub mod tests {
|
||||||
|
|
||||||
assert_eq!(ticks, entries);
|
assert_eq!(ticks, entries);
|
||||||
assert!(Path::new(ledger_path.path())
|
assert!(Path::new(ledger_path.path())
|
||||||
.join(ShredStorageType::RocksLevel.blockstore_directory())
|
.join(BLOCKSTORE_DIRECTORY_ROCKS_LEVEL)
|
||||||
.exists());
|
.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4478,7 +4472,7 @@ pub mod tests {
|
||||||
BlockstoreOptions {
|
BlockstoreOptions {
|
||||||
column_options: LedgerColumnOptions {
|
column_options: LedgerColumnOptions {
|
||||||
shred_storage_type: ShredStorageType::RocksFifo(
|
shred_storage_type: ShredStorageType::RocksFifo(
|
||||||
BlockstoreRocksFifoOptions::default(),
|
BlockstoreRocksFifoOptions::new_for_tests(),
|
||||||
),
|
),
|
||||||
..LedgerColumnOptions::default()
|
..LedgerColumnOptions::default()
|
||||||
},
|
},
|
||||||
|
@ -4492,10 +4486,7 @@ pub mod tests {
|
||||||
|
|
||||||
assert_eq!(ticks, entries);
|
assert_eq!(ticks, entries);
|
||||||
assert!(Path::new(ledger_path.path())
|
assert!(Path::new(ledger_path.path())
|
||||||
.join(
|
.join(BLOCKSTORE_DIRECTORY_ROCKS_FIFO)
|
||||||
ShredStorageType::RocksFifo(BlockstoreRocksFifoOptions::default())
|
|
||||||
.blockstore_directory()
|
|
||||||
)
|
|
||||||
.exists());
|
.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,8 +138,8 @@ impl Default for ShredStorageType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const BLOCKSTORE_DIRECTORY_ROCKS_LEVEL: &str = "rocksdb";
|
pub const BLOCKSTORE_DIRECTORY_ROCKS_LEVEL: &str = "rocksdb";
|
||||||
const BLOCKSTORE_DIRECTORY_ROCKS_FIFO: &str = "rocksdb_fifo";
|
pub const BLOCKSTORE_DIRECTORY_ROCKS_FIFO: &str = "rocksdb_fifo";
|
||||||
|
|
||||||
impl ShredStorageType {
|
impl ShredStorageType {
|
||||||
/// Returns ShredStorageType::RocksFifo where the specified
|
/// Returns ShredStorageType::RocksFifo where the specified
|
||||||
|
@ -212,19 +212,8 @@ pub struct BlockstoreRocksFifoOptions {
|
||||||
pub shred_code_cf_size: u64,
|
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;
|
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 {
|
impl BlockstoreRocksFifoOptions {
|
||||||
fn new(shred_storage_size: u64) -> Self {
|
fn new(shred_storage_size: u64) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -232,6 +221,13 @@ impl BlockstoreRocksFifoOptions {
|
||||||
shred_code_cf_size: shred_storage_size / 2,
|
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)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -266,7 +262,11 @@ fn test_rocksdb_directory() {
|
||||||
BLOCKSTORE_DIRECTORY_ROCKS_LEVEL
|
BLOCKSTORE_DIRECTORY_ROCKS_LEVEL
|
||||||
);
|
);
|
||||||
assert_eq!(
|
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
|
BLOCKSTORE_DIRECTORY_ROCKS_FIFO
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue