From ae36485d134a06f6052911cd832ef98f0310ebbe Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 20 Sep 2018 23:30:00 -0700 Subject: [PATCH] ircd::db: Add back the target level to range compact. --- include/ircd/db/column.h | 2 +- ircd/db.cc | 5 +++-- modules/console.cc | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/ircd/db/column.h b/include/ircd/db/column.h index c72b3eef8..2901789fd 100644 --- a/include/ircd/db/column.h +++ b/include/ircd/db/column.h @@ -60,7 +60,7 @@ namespace ircd::db // [SET] Other operations void setopt(column &, const string_view &key, const string_view &val); - void compact(column &, const std::pair &, const compactor & = {}); + void compact(column &, const std::pair &, const int &to_level = -1, const compactor & = {}); void compact(column &, const int &level = -1, const compactor & = {}); void sort(column &, const bool &blocking = false); } diff --git a/ircd/db.cc b/ircd/db.cc index 57f2219ec..2e48de849 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -358,7 +358,7 @@ ircd::db::compact(database &d, for(const auto &c : d.columns) { db::column column{*c}; - compact(column, range, cb); + compact(column, range, -1, cb); compact(column, -1, cb); } } @@ -7505,6 +7505,7 @@ ircd::db::compact(column &column, void ircd::db::compact(column &column, const std::pair &range, + const int &to_level, const compactor &cb) { database &d(column); @@ -7524,7 +7525,7 @@ ircd::db::compact(column &column, rocksdb::CompactRangeOptions opts; opts.change_level = true; - opts.target_level = -1; + opts.target_level = std::max(to_level, -1); opts.allow_write_stall = true; const ctx::uninterruptible::nothrow ui; diff --git a/modules/console.cc b/modules/console.cc index 4e3593b04..520f6b0ee 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -1245,7 +1245,7 @@ try integer && end? byte_view(integers[1]) : end, }; - compact(column, range); + compact(column, range, level); if(level > -2) compact(column, level);