From fc541e2f086459d35a1c5f408a0f13890501c6d2 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Wed, 27 Jan 2016 13:15:36 -0200 Subject: [PATCH 1/2] compaction: remove code to sort local ranges storage_service::get_local_ranges returns sorted ranges, which are not overlapping nor wrap-around. As a result, there is no need for the consumer to do anything. Signed-off-by: Raphael S. Carvalho --- sstables/compaction.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/sstables/compaction.cc b/sstables/compaction.cc index c004c70b0f..13f8928fad 100644 --- a/sstables/compaction.cc +++ b/sstables/compaction.cc @@ -212,18 +212,6 @@ future<> compact_sstables(std::vector sstables, column_family& c std::vector> owned_ranges; if (cleanup) { owned_ranges = service::get_local_storage_service().get_local_ranges(schema->ks_name()); - // sort owned ranges - std::sort(owned_ranges.begin(), owned_ranges.end(), [](range& a, range& b) { - if (!a.start()) { - return true; - } - if (!b.start()) { - return false; - } - const dht::token& a_start = a.start()->value(); - const dht::token& b_start = b.start()->value(); - return a_start < b_start; - }); } auto reader = make_mutation_reader(schema, std::move(readers), std::move(not_compacted_sstables), std::move(owned_ranges), cleanup); From 45c446d6eb9930f8d45071bbe19a09f304fa42c9 Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Wed, 27 Jan 2016 13:25:41 -0200 Subject: [PATCH 2/2] compaction: pass dht::token by reference Signed-off-by: Raphael S. Carvalho --- sstables/compaction.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sstables/compaction.cc b/sstables/compaction.cc index 13f8928fad..9712c1725f 100644 --- a/sstables/compaction.cc +++ b/sstables/compaction.cc @@ -94,7 +94,7 @@ static api::timestamp_type get_max_purgeable_timestamp(schema_ptr schema, static bool belongs_to_current_node(const dht::token& t, const std::vector>& sorted_owned_ranges) { auto low = std::lower_bound(sorted_owned_ranges.begin(), sorted_owned_ranges.end(), t, - [] (const range& a, const dht::token b) { + [] (const range& a, const dht::token& b) { // check that range a is before token b. return a.after(b, dht::token_comparator()); });