-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge 'staging sstables: filter tokens for view update generation' fr…
…om Benny Halevy This mini-series introduces dht::tokens_filter and uses it for consuming staging sstable in the view_update_generator. The tokens_filter uses the token ranges owned by the current node, as retrieved by get_keyspace_local_ranges. Refs #9559 Closes #11932 * github.com:scylladb/scylladb: db: view_update_generator: always clean up staging sstables compaction: extract incremental_owned_ranges_checker out to dht (cherry picked from commit 3aff59f)
- Loading branch information
Showing
4 changed files
with
53 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Modified by ScyllaDB | ||
* Copyright (C) 2015-present ScyllaDB | ||
*/ | ||
|
||
/* | ||
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0) | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "dht/i_partitioner.hh" | ||
#include "readers/flat_mutation_reader_v2.hh" | ||
|
||
namespace dht { | ||
|
||
class incremental_owned_ranges_checker { | ||
const dht::token_range_vector& _sorted_owned_ranges; | ||
mutable dht::token_range_vector::const_iterator _it; | ||
public: | ||
incremental_owned_ranges_checker(const dht::token_range_vector& sorted_owned_ranges) | ||
: _sorted_owned_ranges(sorted_owned_ranges) | ||
, _it(_sorted_owned_ranges.begin()) { | ||
} | ||
|
||
// Must be called with increasing token values. | ||
bool belongs_to_current_node(const dht::token& t) { | ||
// While token T is after a range Rn, advance the iterator. | ||
// iterator will be stopped at a range which either overlaps with T (if T belongs to node), | ||
// or at a range which is after T (if T doesn't belong to this node). | ||
while (_it != _sorted_owned_ranges.end() && _it->after(t, dht::token_comparator())) { | ||
_it++; | ||
} | ||
|
||
return _it != _sorted_owned_ranges.end() && _it->contains(t, dht::token_comparator()); | ||
} | ||
|
||
static flat_mutation_reader_v2::filter make_partition_filter(const dht::token_range_vector& sorted_owned_ranges); | ||
}; | ||
|
||
} // dht |