diff --git a/include/ircd/db/descriptor.h b/include/ircd/db/descriptor.h index a99cc23a7..b2003a2a2 100644 --- a/include/ircd/db/descriptor.h +++ b/include/ircd/db/descriptor.h @@ -84,8 +84,9 @@ struct ircd::db::descriptor /// Compression algorithm for this column. Empty string is equal to /// kNoCompression. List is semicolon separated to allow fallbacks in - /// case the first algorithms are not supported. - std::string compression {"kLZ4Compression;kSnappyCompression"}; + /// case the first algorithms are not supported. "default" will be + // replaced by the string in the ircd.db.compression.default conf item. + std::string compression {"default"}; /// User given compaction callback surface. db::compactor compactor {}; diff --git a/ircd/db.cc b/ircd/db.cc index d8c960a84..2eadce449 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -8947,14 +8947,33 @@ catch(const not_found &) // Misc // +namespace ircd::db +{ + extern conf::item compression_default; +} + +decltype(ircd::db::compression_default) +ircd::db::compression_default +{ + { "name", "ircd.db.compression.default" }, + { "default", "kLZ4Compression;kSnappyCompression" }, +}; + rocksdb::CompressionType -ircd::db::find_supported_compression(const std::string &list) +ircd::db::find_supported_compression(const std::string &input) { rocksdb::CompressionType ret { rocksdb::kNoCompression }; + const auto &list + { + input == "default"? + string_view{compression_default}: + string_view{input} + }; + tokens(list, ';', [&ret] (const string_view &requested) { diff --git a/matrix/dbs_event_horizon.cc b/matrix/dbs_event_horizon.cc index 5eb3580ee..c9da7f0ec 100644 --- a/matrix/dbs_event_horizon.cc +++ b/matrix/dbs_event_horizon.cc @@ -130,7 +130,7 @@ ircd::m::dbs::desc::event_horizon size_t(event_horizon__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_event_idx.cc b/matrix/dbs_event_idx.cc index 55867a817..44596ff3a 100644 --- a/matrix/dbs_event_idx.cc +++ b/matrix/dbs_event_idx.cc @@ -118,7 +118,7 @@ ircd::m::dbs::desc::event_idx size_t(event_idx__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_event_json.cc b/matrix/dbs_event_json.cc index 28b82664f..6ce3b8be7 100644 --- a/matrix/dbs_event_json.cc +++ b/matrix/dbs_event_json.cc @@ -107,7 +107,7 @@ ircd::m::dbs::desc::event_json size_t(event_json__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_event_sender.cc b/matrix/dbs_event_sender.cc index 845c50762..3a0a3eaac 100644 --- a/matrix/dbs_event_sender.cc +++ b/matrix/dbs_event_sender.cc @@ -142,7 +142,7 @@ ircd::m::dbs::desc::event_sender size_t(event_sender__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_event_state.cc b/matrix/dbs_event_state.cc index 465813bd3..df0abd45d 100644 --- a/matrix/dbs_event_state.cc +++ b/matrix/dbs_event_state.cc @@ -116,7 +116,7 @@ ircd::m::dbs::desc::event_state size_t(event_state__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_event_type.cc b/matrix/dbs_event_type.cc index 0535dbe25..0eb64606f 100644 --- a/matrix/dbs_event_type.cc +++ b/matrix/dbs_event_type.cc @@ -119,7 +119,7 @@ ircd::m::dbs::desc::event_type size_t(event_type__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_room_joined.cc b/matrix/dbs_room_joined.cc index 56bbbc50b..ed3d62d68 100644 --- a/matrix/dbs_room_joined.cc +++ b/matrix/dbs_room_joined.cc @@ -125,7 +125,7 @@ ircd::m::dbs::desc::room_joined size_t(room_joined__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_room_state.cc b/matrix/dbs_room_state.cc index 0be6023f7..b95110e46 100644 --- a/matrix/dbs_room_state.cc +++ b/matrix/dbs_room_state.cc @@ -134,7 +134,7 @@ ircd::m::dbs::desc::room_state size_t(room_state__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_room_state_space.cc b/matrix/dbs_room_state_space.cc index 44539893d..f46c22aef 100644 --- a/matrix/dbs_room_state_space.cc +++ b/matrix/dbs_room_state_space.cc @@ -134,7 +134,7 @@ ircd::m::dbs::desc::room_state_space size_t(room_state_space__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {}, diff --git a/matrix/dbs_room_type.cc b/matrix/dbs_room_type.cc index 2c5f83566..8603e9034 100644 --- a/matrix/dbs_room_type.cc +++ b/matrix/dbs_room_type.cc @@ -142,7 +142,7 @@ ircd::m::dbs::desc::room_type size_t(room_type__meta_block__size), // compression - "kLZ4Compression;kSnappyCompression"s, + "default"s, // compactor {},