From 3dcf00ec677ed10ead80d7a9cd63c0db775d6ccd Mon Sep 17 00:00:00 2001 From: "Raphael S. Carvalho" Date: Sun, 31 Dec 2017 00:45:29 -0200 Subject: [PATCH] sstables: feed new sstable with its owner shard Missed opportunity to feed shard id to sstable being written when working on 67c5c8dc6776, so when sstable is reopened after sealed, its shard doesn't need to be recomputed by open procedure. Signed-off-by: Raphael S. Carvalho Message-Id: <20171231024529.13664-1-raphaelsc@scylladb.com> --- sstables/sstables.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 030d0bd84f..48be6892d0 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -1305,7 +1305,9 @@ future<> sstable::open_data() { _data_file = std::get(std::get<1>(files).get()); return this->update_info_for_opened_data(); }).then([this] { - _shards = compute_shards_for_this_sstable(); + if (_shards.empty()) { + _shards = compute_shards_for_this_sstable(); + } }); } @@ -2318,6 +2320,7 @@ sstable_writer::sstable_writer(sstable& sst, const schema& s, uint64_t estimated _compression_enabled = !_sst.has_component(sstable::component_type::CRC); prepare_file_writer(); _components_writer.emplace(_sst, _schema, *_writer, estimated_partitions, cfg, _pc); + _sst._shards = { shard }; } static sstable_enabled_features all_features() {