mirror of
https://github.com/matrix-construct/construct
synced 2025-03-14 05:20:17 +01:00
ircd::db: Add compaction priority option to descriptor.
ircd:Ⓜ️:dbs: Tune compaction priority algorithm.
This commit is contained in:
parent
7fcd0c948d
commit
829516afde
4 changed files with 111 additions and 4 deletions
|
@ -90,6 +90,9 @@ struct ircd::db::descriptor
|
|||
/// User given compaction callback surface.
|
||||
db::compactor compactor {};
|
||||
|
||||
/// Compaction priority algorithm
|
||||
std::string compaction_pri {"kOldestLargestSeqFirst"};
|
||||
|
||||
/// Compaction related parameters. see: rocksdb/advanced_options.h
|
||||
struct
|
||||
{
|
||||
|
|
14
ircd/db.cc
14
ircd/db.cc
|
@ -1930,9 +1930,17 @@ ircd::db::database::column::column(database &d,
|
|||
//this->options.compaction_style = rocksdb::kCompactionStyleNone;
|
||||
this->options.compaction_style = rocksdb::kCompactionStyleLevel;
|
||||
|
||||
// Set the compaction priority; this should probably be in the descriptor
|
||||
// but this is currently selected for the general matrix workload.
|
||||
this->options.compaction_pri = rocksdb::CompactionPri::kOldestSmallestSeqFirst;
|
||||
// Set the compaction priority from string in the descriptor
|
||||
this->options.compaction_pri =
|
||||
this->descriptor->compaction_pri == "kByCompensatedSize"?
|
||||
rocksdb::CompactionPri::kByCompensatedSize:
|
||||
this->descriptor->compaction_pri == "kMinOverlappingRatio"?
|
||||
rocksdb::CompactionPri::kMinOverlappingRatio:
|
||||
this->descriptor->compaction_pri == "kOldestSmallestSeqFirst"?
|
||||
rocksdb::CompactionPri::kOldestSmallestSeqFirst:
|
||||
this->descriptor->compaction_pri == "kOldestLargestSeqFirst"?
|
||||
rocksdb::CompactionPri::kOldestLargestSeqFirst:
|
||||
rocksdb::CompactionPri::kOldestLargestSeqFirst;
|
||||
|
||||
// Set filter reductions for this column. This means we expect a key to exist.
|
||||
this->options.optimize_filters_for_hits = this->descriptor->expect_queries_hit;
|
||||
|
|
|
@ -1651,6 +1651,15 @@ ircd::m::dbs::desc::events__event_idx
|
|||
|
||||
// meta_block size
|
||||
size_t(events__event_idx__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -1758,6 +1767,9 @@ ircd::m::dbs::desc::events__event_json
|
|||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestLargestSeqFirst"s,
|
||||
|
||||
// target_file_size
|
||||
{
|
||||
2_GiB, // base
|
||||
|
@ -1991,6 +2003,15 @@ ircd::m::dbs::desc::events__event_refs
|
|||
|
||||
// meta_block size
|
||||
size_t(events__event_refs__meta_block__size),
|
||||
|
||||
// compression
|
||||
{}, // no compression for this column
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -2161,6 +2182,15 @@ ircd::m::dbs::desc::events__event_horizon
|
|||
|
||||
// meta_block size
|
||||
size_t(events__event_horizon__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -2396,6 +2426,15 @@ ircd::m::dbs::desc::events__event_sender
|
|||
|
||||
// meta_block size
|
||||
size_t(events__event_sender__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -2542,6 +2581,15 @@ ircd::m::dbs::desc::events__event_type
|
|||
|
||||
// meta_block size
|
||||
size_t(events__event_type__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -2749,6 +2797,15 @@ ircd::m::dbs::desc::events__event_state
|
|||
|
||||
// meta_block size
|
||||
size_t(events__event_state__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -2888,6 +2945,12 @@ ircd::m::dbs::desc::events__room_head
|
|||
|
||||
// compression
|
||||
{}, // no compression for this column
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kByCompensatedSize"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -3318,6 +3381,15 @@ ircd::m::dbs::desc::events__room_joined
|
|||
|
||||
// meta_block size
|
||||
size_t(events__room_joined__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -3496,6 +3568,15 @@ ircd::m::dbs::desc::events__room_state
|
|||
|
||||
// meta_block size
|
||||
size_t(events__room_state__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -3771,6 +3852,15 @@ ircd::m::dbs::desc::events__room_state_space
|
|||
|
||||
// meta_block size
|
||||
size_t(events__room_state_space__meta_block__size),
|
||||
|
||||
// compression
|
||||
"kLZ4Compression;kSnappyCompression"s,
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
@ -90,7 +90,13 @@ ircd::m::media::blocks_descriptor
|
|||
512,
|
||||
|
||||
// compression
|
||||
""s // no compression
|
||||
{}, // no compression
|
||||
|
||||
// compactor
|
||||
{},
|
||||
|
||||
// compaction priority algorithm
|
||||
"kOldestSmallestSeqFirst"s,
|
||||
};
|
||||
|
||||
decltype(ircd::m::media::description)
|
||||
|
|
Loading…
Add table
Reference in a new issue