From ebea2e23854c8a4c1ac82c0d119e4d47e04798b0 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 20 Apr 2018 16:48:07 -0700 Subject: [PATCH] ircd::db: Explicitly involve SST files in column compaction. --- ircd/db.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ircd/db.cc b/ircd/db.cc index b9339dc4b..53a83f3f0 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -3988,6 +3988,34 @@ ircd::db::compact(column &column, { d.d->CompactRange(opts, c, b, e) }; + + rocksdb::ColumnFamilyMetaData cfmd; + d.d->GetColumnFamilyMetaData(c, &cfmd); + for(const auto &level : cfmd.levels) + { + if(level.files.empty()) + continue; + + std::vector files(level.files.size()); + std::transform(level.files.begin(), level.files.end(), files.begin(), [] + (auto &metadata) + { + return std::move(metadata.name); + }); + + log.debug("'%s':'%s' COMPACT level:%d files:%zu size:%zu", + name(d), + name(c), + level.level, + level.files.size(), + level.size); + + rocksdb::CompactionOptions opts; + throw_on_error + { + d.d->CompactFiles(opts, c, files, level.level) + }; + } } void