(LedgerStore) Use different path for different blockstore storage type. (#23236)

#### Summary of Changes
To avoid mixing the use of different shred storage types, each shred storage type
will have its blockstore in a different directory.

This PR still keeps the RocksFifo setting hidden.  The default ShredStorageType and
blockstore directory are still RocksLevel and `rocksdb`.

Will follow-up with PRs on making FIFO option public in ledger-tool and validator.

#### Test Plan
* Added a new test to verify the existence of `rocksdb-fifo` directory when FIFO compaction is used.
* Updated existing test to verify the current setting still store ledger under `rocksdb` directory.
* Manually ran ledger_cleanup_test with both level and fifo compaction and verified the resulting ledger.
* Ran a validator with this PR.
This commit is contained in:
Yueh-Hsuan Chiang
2022-03-02 18:30:22 -08:00
committed by GitHub
parent 39387e8446
commit 634f4eb37d
6 changed files with 161 additions and 16 deletions

View File

@ -467,6 +467,9 @@ fn is_valid_genesis_archive_entry(parts: &[&str], kind: tar::EntryType) -> bool
(["rocksdb"], Directory) => true,
(["rocksdb", _], GNUSparse) => true,
(["rocksdb", _], Regular) => true,
(["rocksdb_fifo"], Directory) => true,
(["rocksdb_fifo", _], GNUSparse) => true,
(["rocksdb_fifo", _], Regular) => true,
_ => false,
}
}
@ -600,6 +603,18 @@ mod tests {
&["rocksdb", "foo"],
tar::EntryType::GNUSparse,
));
assert!(is_valid_genesis_archive_entry(
&["rocksdb_fifo"],
tar::EntryType::Directory
));
assert!(is_valid_genesis_archive_entry(
&["rocksdb_fifo", "foo"],
tar::EntryType::Regular
));
assert!(is_valid_genesis_archive_entry(
&["rocksdb_fifo", "foo"],
tar::EntryType::GNUSparse,
));
assert!(!is_valid_genesis_archive_entry(
&["aaaa"],
@ -633,6 +648,30 @@ mod tests {
&["rocksdb", "foo", "bar"],
tar::EntryType::GNUSparse
));
assert!(!is_valid_genesis_archive_entry(
&["rocksdb_fifo"],
tar::EntryType::Regular
));
assert!(!is_valid_genesis_archive_entry(
&["rocksdb_fifo"],
tar::EntryType::GNUSparse,
));
assert!(!is_valid_genesis_archive_entry(
&["rocksdb_fifo", "foo"],
tar::EntryType::Directory,
));
assert!(!is_valid_genesis_archive_entry(
&["rocksdb_fifo", "foo", "bar"],
tar::EntryType::Directory,
));
assert!(!is_valid_genesis_archive_entry(
&["rocksdb_fifo", "foo", "bar"],
tar::EntryType::Regular
));
assert!(!is_valid_genesis_archive_entry(
&["rocksdb_fifo", "foo", "bar"],
tar::EntryType::GNUSparse
));
}
fn with_finalize_and_unpack<C>(archive: tar::Builder<Vec<u8>>, checker: C) -> Result<()>