From 45905ec94d4e7cb95f59f2f78e941cf86a86d367 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Mon, 6 Jul 2015 17:57:13 -0400 Subject: [PATCH] dht: change partitioner name to sstring It is a better fit for things that are names, not blobs. We have a user that expects a bytes parameter, but that is for no other reason than the fact that the field used to be of bytes type. Let's fix that, and future users will be able to use sstrings Signed-off-by: Glauber Costa --- dht/i_partitioner.hh | 2 +- dht/murmur3_partitioner.hh | 2 +- sstables/sstables.cc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dht/i_partitioner.hh b/dht/i_partitioner.hh index 9cc37d54f7..406495b61f 100644 --- a/dht/i_partitioner.hh +++ b/dht/i_partitioner.hh @@ -193,7 +193,7 @@ public: /** * @return name of partitioner. */ - virtual const bytes name() = 0; + virtual const sstring name() = 0; protected: /** * @return true if t1's _data array is equal t2's. _kind comparison should be done separately. diff --git a/dht/murmur3_partitioner.hh b/dht/murmur3_partitioner.hh index 89f5b21918..c773c69856 100644 --- a/dht/murmur3_partitioner.hh +++ b/dht/murmur3_partitioner.hh @@ -11,7 +11,7 @@ namespace dht { class murmur3_partitioner final : public i_partitioner { public: - virtual const bytes name() { return "org.apache.cassandra.dht.Murmur3Partitioner"; } + virtual const sstring name() { return "org.apache.cassandra.dht.Murmur3Partitioner"; } virtual token get_token(const schema& s, partition_key_view key) override; virtual token get_token(const sstables::key_view& key) override; virtual token get_random_token() override; diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 86870e85e3..75dc7e9a07 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -1118,7 +1118,7 @@ static void maybe_add_summary_entry(summary& s, bytes_view key, uint64_t offset) // In the beginning of the statistics file, there is a disk_hash used to // map each metadata type to its correspondent position in the file. static void seal_statistics(statistics& s, metadata_collector& collector, - const bytes partitioner, double bloom_filter_fp_chance) { + const sstring partitioner, double bloom_filter_fp_chance) { static constexpr int METADATA_TYPE_COUNT = 3; size_t old_offset, offset = 0; @@ -1132,7 +1132,7 @@ static void seal_statistics(statistics& s, metadata_collector& collector, stats_metadata stats; old_offset = offset; - validation.partitioner.value = partitioner; + validation.partitioner.value = to_bytes(partitioner); validation.filter_chance = bloom_filter_fp_chance; offset += validation.serialized_size(); s.contents[metadata_type::Validation] = std::make_unique(std::move(validation));