0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd::db: Add compaction period parameter to descriptor.

This commit is contained in:
Jason Volk 2020-06-07 05:30:17 -07:00
parent 6e5da0dee6
commit 6968f24921
3 changed files with 17 additions and 3 deletions

View file

@ -118,4 +118,10 @@ struct ircd::db::descriptor
{ 0L, 15L }, // max_bytes_for_level[5] { 0L, 15L }, // max_bytes_for_level[5]
{ 0L, 31L }, // max_bytes_for_level[6] { 0L, 31L }, // max_bytes_for_level[6]
}; };
/// Forces compaction within a certain limit of time
seconds compaction_period
{
60s * 60 * 24 * 21 // 21 day period
};
}; };

View file

@ -2007,6 +2007,10 @@ ircd::db::database::column::column(database &d,
this->options.level0_file_num_compaction_trigger = 2; this->options.level0_file_num_compaction_trigger = 2;
this->options.disable_auto_compactions = false; this->options.disable_auto_compactions = false;
this->options.level_compaction_dynamic_level_bytes = false; this->options.level_compaction_dynamic_level_bytes = false;
this->options.ttl = 0;
#ifdef IRCD_DB_HAS_PERIODIC_COMPACTIONS
this->options.periodic_compaction_seconds = this->descriptor->compaction_period.count();
#endif
this->options.target_file_size_base = this->descriptor->target_file_size.base; 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.target_file_size_multiplier = this->descriptor->target_file_size.multiplier;
@ -8699,9 +8703,7 @@ ircd::db::reflect(const rocksdb::CompactionReason &r)
case CompactionReason::kFlush: return "Flush"; case CompactionReason::kFlush: return "Flush";
case CompactionReason::kExternalSstIngestion: return "ExternalSstIngestion"; case CompactionReason::kExternalSstIngestion: return "ExternalSstIngestion";
#if ROCKSDB_MAJOR > 6 \ #ifdef IRCD_DB_HAS_PERIODIC_COMPACTIONS
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR > 6) \
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 6 && ROCKSDB_PATCH >= 2)
case CompactionReason::kPeriodicCompaction: return "kPeriodicCompaction"; case CompactionReason::kPeriodicCompaction: return "kPeriodicCompaction";
#endif #endif

View file

@ -36,3 +36,9 @@
|| (ROCKSDB_MAJOR == 5 && ROCKSDB_MINOR >= 18) || (ROCKSDB_MAJOR == 5 && ROCKSDB_MINOR >= 18)
#define IRCD_DB_HAS_ALLOCATOR #define IRCD_DB_HAS_ALLOCATOR
#endif #endif
#if ROCKSDB_MAJOR > 6 \
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR > 2) \
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 2 && ROCKSDB_PATCH >= 2)
#define IRCD_DB_HAS_PERIODIC_COMPACTIONS
#endif