0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

ircd::db: Add granular compaction size related to column descriptor. (#13)

This commit is contained in:
Jason Volk 2019-08-26 12:14:26 -07:00
parent 30b2f8bfee
commit f073657b5a
2 changed files with 53 additions and 7 deletions

View file

@ -89,4 +89,30 @@ struct ircd::db::descriptor
/// User given compaction callback surface. /// User given compaction callback surface.
db::compactor compactor {}; db::compactor compactor {};
/// Compaction related parameters. see: rocksdb/advanced_options.h
struct
{
size_t base {64_MiB}; // rocksdb default
size_t multiplier {1}; // rocksdb default
}
target_file_size;
/// Compaction related parameters. see: rocksdb/advanced_options.h
struct max_bytes_for_level
{
size_t base {0};
size_t multiplier {1};
}
max_bytes_for_level[8]
{
{ 256_MiB, 10L }, // max_bytes_for_level_base
{ 0L, 1L }, // max_bytes_for_level[0]
{ 0L, 1L }, // max_bytes_for_level[1]
{ 0L, 1L }, // max_bytes_for_level[2]
{ 0L, 1L }, // max_bytes_for_level[3]
{ 0L, 1L }, // max_bytes_for_level[4]
{ 0L, 1L }, // max_bytes_for_level[5]
{ 0L, 1L }, // max_bytes_for_level[6]
};
}; };

View file

@ -1839,19 +1839,39 @@ ircd::db::database::column::column(database &d,
//this->options.bottommost_compression_opts = this->options.compression_opts; //this->options.bottommost_compression_opts = this->options.compression_opts;
//TODO: descriptor / conf //TODO: descriptor / conf
this->options.disable_auto_compactions = false;
this->options.level_compaction_dynamic_level_bytes = false;
this->options.num_levels = 7;
this->options.write_buffer_size = 4_MiB; this->options.write_buffer_size = 4_MiB;
this->options.max_write_buffer_number = 8; this->options.max_write_buffer_number = 8;
this->options.min_write_buffer_number_to_merge = 4; this->options.min_write_buffer_number_to_merge = 4;
this->options.max_write_buffer_number_to_maintain = 0; this->options.max_write_buffer_number_to_maintain = 0;
this->options.num_levels = 7;
this->options.level0_file_num_compaction_trigger = 2; this->options.level0_file_num_compaction_trigger = 2;
this->options.target_file_size_base = 48_MiB; this->options.disable_auto_compactions = false;
this->options.target_file_size_multiplier = 16; this->options.level_compaction_dynamic_level_bytes = false;
this->options.max_bytes_for_level_base = 1_MiB;
this->options.max_bytes_for_level_multiplier = 2; this->options.target_file_size_base = this->descriptor->target_file_size.base;
this->options.target_file_size_multiplier = this->descriptor->target_file_size.multiplier;
this->options.max_bytes_for_level_base = this->descriptor->max_bytes_for_level[0].base;
this->options.max_bytes_for_level_multiplier = this->descriptor->max_bytes_for_level[0].multiplier;
this->options.max_bytes_for_level_multiplier_additional = std::vector<int>(this->options.num_levels, 1);
{
auto &dst(this->options.max_bytes_for_level_multiplier_additional);
const auto &src(this->descriptor->max_bytes_for_level);
const size_t src_size(std::distance(begin(src) + 1, std::end(src)));
assert(src_size >= 1);
const auto end
{
begin(src) + 1 + std::min(dst.size(), src_size)
};
std::transform(begin(src) + 1, end, begin(dst), []
(const auto &mbfl)
{
return mbfl.multiplier;
});
}
// //
// Table options // Table options