Skip to content

Commit 9feefd2

Browse files
iovoidjrchatrucpablodeymo
authored
feat(l1)!: compress some tables (#5323)
**Motivation** We disabled compression for all tables, but some tables with less but larger elements could benefit and bring small space savings. **Description** This PR enables compression for codes and other, smaller, compressible tables. --------- Co-authored-by: Javier Chatruc <jrchatruc@gmail.com> Co-authored-by: Pablo Deymonnaz <pdeymon@fi.uba.ar>
1 parent bb1eb9e commit 9feefd2

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

crates/storage/store_db/rocksdb.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ impl Store {
224224
db_options.set_compaction_readahead_size(4 * 1024 * 1024); // 4MB
225225
db_options.set_advise_random_on_open(false);
226226
db_options.set_compression_type(rocksdb::DBCompressionType::None);
227-
db_options.set_bottommost_compression_type(rocksdb::DBCompressionType::None);
228227

229228
// db_options.enable_statistics();
230229
// db_options.set_stats_dump_period_sec(600);
@@ -249,6 +248,14 @@ impl Store {
249248
CF_STORAGE_FLATKEYVALUE,
250249
CF_MISC_VALUES,
251250
];
251+
let compressible_cfs = [
252+
CF_BLOCK_NUMBERS,
253+
CF_HEADERS,
254+
CF_BODIES,
255+
CF_RECEIPTS,
256+
CF_TRANSACTION_LOCATIONS,
257+
CF_FULLSYNC_HEADERS,
258+
];
252259

253260
// Get existing column families to know which ones to drop later
254261
let existing_cfs = match DBWithThreadMode::<MultiThreaded>::list_cf(&db_options, path) {
@@ -286,7 +293,12 @@ impl Store {
286293
cf_opts.set_level_zero_file_num_compaction_trigger(4);
287294
cf_opts.set_level_zero_slowdown_writes_trigger(20);
288295
cf_opts.set_level_zero_stop_writes_trigger(36);
289-
cf_opts.set_compression_type(rocksdb::DBCompressionType::None);
296+
297+
if compressible_cfs.contains(&cf_name.as_str()) {
298+
cf_opts.set_compression_type(rocksdb::DBCompressionType::Lz4);
299+
} else {
300+
cf_opts.set_compression_type(rocksdb::DBCompressionType::None);
301+
}
290302

291303
match cf_name.as_str() {
292304
CF_HEADERS | CF_BODIES => {

0 commit comments

Comments
 (0)