mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
test/lib/sstable_utils: remove now unused token_generation_for_shard() and friends
This commit is contained in:
@@ -98,35 +98,6 @@ shared_sstable make_sstable_easy(test_env& env, const fs::path& path, lw_shared_
|
||||
return sst;
|
||||
}
|
||||
|
||||
std::vector<std::pair<sstring, dht::token>>
|
||||
token_generation_for_shard(unsigned tokens_to_generate, unsigned shard,
|
||||
unsigned ignore_msb, unsigned smp_count) {
|
||||
unsigned tokens = 0;
|
||||
unsigned key_id = 0;
|
||||
std::vector<std::pair<sstring, dht::token>> key_and_token_pair;
|
||||
|
||||
key_and_token_pair.reserve(tokens_to_generate);
|
||||
dht::murmur3_partitioner partitioner;
|
||||
dht::sharder sharder(smp_count, ignore_msb);
|
||||
|
||||
while (tokens < tokens_to_generate) {
|
||||
sstring key = to_sstring(key_id++);
|
||||
dht::token token = create_token_from_key(partitioner, key);
|
||||
if (shard != sharder.shard_of(token)) {
|
||||
continue;
|
||||
}
|
||||
tokens++;
|
||||
key_and_token_pair.emplace_back(key, token);
|
||||
}
|
||||
assert(key_and_token_pair.size() == tokens_to_generate);
|
||||
|
||||
std::sort(key_and_token_pair.begin(),key_and_token_pair.end(), [] (auto& i, auto& j) {
|
||||
return i.second < j.second;
|
||||
});
|
||||
|
||||
return key_and_token_pair;
|
||||
}
|
||||
|
||||
future<compaction_result> compact_sstables(compaction_manager& cm, sstables::compaction_descriptor descriptor, table_state& table_s, std::function<shared_sstable()> creator, compaction_sstable_replacer_fn replacer,
|
||||
can_purge_tombstones can_purge) {
|
||||
descriptor.creator = [creator = std::move(creator)] (shard_id dummy) mutable {
|
||||
@@ -146,10 +117,6 @@ future<compaction_result> compact_sstables(compaction_manager& cm, sstables::com
|
||||
co_return ret;
|
||||
}
|
||||
|
||||
std::vector<std::pair<sstring, dht::token>> token_generation_for_current_shard(unsigned tokens_to_generate) {
|
||||
return token_generation_for_shard(tokens_to_generate, this_shard_id());
|
||||
}
|
||||
|
||||
static sstring toc_filename(const sstring& dir, schema_ptr schema, unsigned int generation, sstable_version_types v) {
|
||||
return sstable::filename(dir, schema->ks_name(), schema->cf_name(), v, generation_from_value(generation),
|
||||
sstable_format_types::big, component_type::TOC);
|
||||
|
||||
@@ -34,13 +34,6 @@ inline future<> write_memtable_to_sstable_for_test(replica::memtable& mt, sstabl
|
||||
shared_sstable make_sstable(sstables::test_env& env, schema_ptr s, sstring dir, std::vector<mutation> mutations,
|
||||
sstable_writer_config cfg, sstables::sstable::version_types version, gc_clock::time_point query_time = gc_clock::now());
|
||||
|
||||
std::vector<std::pair<sstring, dht::token>>
|
||||
token_generation_for_shard(unsigned tokens_to_generate, unsigned shard,
|
||||
unsigned ignore_msb = 0, unsigned smp_count = smp::count);
|
||||
|
||||
std::vector<std::pair<sstring, dht::token>>
|
||||
token_generation_for_current_shard(unsigned tokens_to_generate);
|
||||
|
||||
namespace sstables {
|
||||
|
||||
using sstable_ptr = shared_sstable;
|
||||
|
||||
@@ -14,22 +14,6 @@
|
||||
#include "gms/feature_service.hh"
|
||||
#include "repair/row_level.hh"
|
||||
|
||||
dht::token create_token_from_key(const dht::i_partitioner& partitioner, sstring key) {
|
||||
sstables::key_view key_view = sstables::key_view(bytes_view(reinterpret_cast<const signed char*>(key.c_str()), key.size()));
|
||||
dht::token token = partitioner.get_token(key_view);
|
||||
assert(token == partitioner.get_token(key_view));
|
||||
return token;
|
||||
}
|
||||
|
||||
range<dht::token> create_token_range_from_keys(const dht::sharder& sinfo, const dht::i_partitioner& partitioner, sstring start_key, sstring end_key) {
|
||||
dht::token start = create_token_from_key(partitioner, start_key);
|
||||
assert(this_shard_id() == sinfo.shard_of(start));
|
||||
dht::token end = create_token_from_key(partitioner, end_key);
|
||||
assert(this_shard_id() == sinfo.shard_of(end));
|
||||
assert(end >= start);
|
||||
return range<dht::token>::make(start, end);
|
||||
}
|
||||
|
||||
static const sstring some_keyspace("ks");
|
||||
static const sstring some_column_family("cf");
|
||||
|
||||
|
||||
@@ -76,6 +76,3 @@ struct table_for_tests {
|
||||
return stop().finally([cf = *this] {});
|
||||
}
|
||||
};
|
||||
|
||||
dht::token create_token_from_key(const dht::i_partitioner&, sstring key);
|
||||
range<dht::token> create_token_range_from_keys(const dht::sharder& sharder, const dht::i_partitioner&, sstring start_key, sstring end_key);
|
||||
|
||||
Reference in New Issue
Block a user