From abcfc19fe9e79dd86d3d932dab065e0feb7059de Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Fri, 4 May 2018 15:21:58 -0300 Subject: [PATCH] db: make compaction slightly faster by not using filtering reader on unshared sstable After reboot, all existing sstables are considered shared. That's a safe default. Reader used by compaction decides to use filtering reader (filters out data that doesn't belong to this shard) if sstable is considered shared even though it may actually be unshared. By avoiding filtering reader we're avoiding an extra check for each key, and that may be meaningful for compaction of tons of small partitions and even range reads of such. We do so by fixing sstable::_shared, which is now set properly for existing sstables at start. quick check using microbenchmark which extends perf_sstable with compaction mode: before: 69407.61 +- 37.03 partitions / sec (30 runs, 1 concurrent ops) after: 70161.09 +- 40.35 partitions / sec (30 runs, 1 concurrent ops) Fixes #3042. Signed-off-by: Raphael S. Carvalho Message-Id: <20180504182158.21130-1-raphaelsc@scylladb.com> --- database.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/database.cc b/database.cc index 9f346a4618..35e02eb27d 100644 --- a/database.cc +++ b/database.cc @@ -761,6 +761,9 @@ column_family::open_sstable(sstables::foreign_sstable_open_info info, sstring di dblog.debug("sstable {} not relevant for this shard, ignoring", sst->get_filename()); return make_ready_future(); } + if (!belongs_to_other_shard(info.owners)) { + sst->set_unshared(); + } return sst->load(std::move(info)).then([sst] () mutable { return make_ready_future(std::move(sst)); });