From 7c3291b5eabe114e5d9e771ef89dcbebb10ce310 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Tue, 16 Apr 2024 09:20:40 +0200 Subject: [PATCH] storage_proxy: Avoid shard_of() use in mutate_counter_on_leader_and_replicate() Cunters are not supported with tablets, so we should not reach this path. --- service/storage_proxy.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index f714ac3e82..34b8cdf491 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -3126,7 +3126,9 @@ future<> storage_proxy::mutate_counter_on_leader_and_replicate(const schema_ptr& s, frozen_mutation fm, db::consistency_level cl, clock_type::time_point timeout, tracing::trace_state_ptr trace_state, service_permit permit) { auto erm = _db.local().find_column_family(s).get_effective_replication_map(); - auto shard = erm->get_sharder(*s).shard_of(fm.token(*s)); + // FIXME: This does not handle intra-node tablet migration properly. + // Refs https://github.com/scylladb/scylladb/issues/18180 + auto shard = erm->get_sharder(*s).shard_for_reads(fm.token(*s)); bool local = shard == this_shard_id(); get_stats().replica_cross_shard_ops += !local; return _db.invoke_on(shard, {_write_smp_service_group, timeout}, [&proxy = container(), gs = global_schema_ptr(s), fm = std::move(fm), cl, timeout, gt = tracing::global_trace_state_ptr(std::move(trace_state)), permit = std::move(permit), local] (replica::database& db) {