0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 18:18:56 +02: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, 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.disable_auto_compactions = 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_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::kExternalSstIngestion: return "ExternalSstIngestion";
#if ROCKSDB_MAJOR > 6 \
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR > 6) \
|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 6 && ROCKSDB_PATCH >= 2)
#ifdef IRCD_DB_HAS_PERIODIC_COMPACTIONS
case CompactionReason::kPeriodicCompaction: return "kPeriodicCompaction";
#endif

View file

@ -36,3 +36,9 @@
|| (ROCKSDB_MAJOR == 5 && ROCKSDB_MINOR >= 18)
#define IRCD_DB_HAS_ALLOCATOR
#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