mutation_partition_serializer: use old counter ordering if necessary

Until the cluster is fully upgraded from a version that uses the
incorrect counter shard ordering it is essential to keep using it lest
the old nodes corrupt the data upon receiving mutations with a counter
shard ordering they do not expect.
This commit is contained in:
Paweł Dziepak
2017-09-01 09:57:13 +01:00
parent b540516e5e
commit 4aa72c6454

View File

@@ -62,8 +62,14 @@ auto write_counter_cell(Writer&& writer, atomic_cell_view c)
counter_cell_view ccv(c);
auto shards = std::move(value).start_value_counter_cell_full()
.start_shards();
for (auto csv : ccv.shards()) {
shards.add_shards(counter_shard(csv));
if (service::get_local_storage_service().cluster_supports_correct_counter_order()) {
for (auto csv : ccv.shards()) {
shards.add_shards(counter_shard(csv));
}
} else {
for (auto& cs : ccv.shards_compatible_with_1_7_4()) {
shards.add_shards(cs);
}
}
return std::move(shards).end_shards().end_counter_cell_full();
}