From a59618e83dabfddeb87fb1d057ad5a8b07f4e7b2 Mon Sep 17 00:00:00 2001 From: Ferenc Szili Date: Fri, 31 Jan 2025 11:50:21 +0100 Subject: [PATCH] truncate: create session during request handling Currently, the session ID under which the truncate for tablets request is running is created during the request creation and queuing. This is a problem because this could overwrite the session ID of any ongoing operation on system.topology#session This change moves the creation of the session ID for truncate from the request creation to the request handling. Fixes #22613 Closes scylladb/scylladb#22615 --- service/storage_proxy.cc | 1 - service/topology_coordinator.cc | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 5cb726b54d..555b0a019d 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -1093,7 +1093,6 @@ private: updates.emplace_back(topology_mutation_builder(guard.write_timestamp()) .set_global_topology_request(global_topology_request::truncate_table) .set_global_topology_request_id(global_request_id) - .set_session(session_id(global_request_id)) .build()); updates.emplace_back(topology_request_tracking_mutation_builder(global_request_id) diff --git a/service/topology_coordinator.cc b/service/topology_coordinator.cc index 5f478fc3ba..f886b5fbea 100644 --- a/service/topology_coordinator.cc +++ b/service/topology_coordinator.cc @@ -933,6 +933,7 @@ class topology_coordinator : public endpoint_lifecycle_subscriber { std::vector updates; updates.push_back(topology_mutation_builder(guard.write_timestamp()) .set_transition_state(topology::transition_state::truncate_table) + .set_session(session_id(_topo_sm._topology.global_request_id.value())) .build()); co_await update_topology_state(std::move(guard), std::move(updates), "TRUNCATE TABLE requested"); }