system_keyspace: De-static get_last_group0_state_id()
The caller is raft_group0_client with sys.ks. dependency reference and group0_state_machine with raft_group0_client exporing its sys.ks. This makes it possible to instantly drop one more qctx reference Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -2384,7 +2384,7 @@ future<> system_keyspace::set_raft_group0_id(utils::UUID uuid) {
|
||||
static constexpr auto GROUP0_HISTORY_KEY = "history";
|
||||
|
||||
future<utils::UUID> system_keyspace::get_last_group0_state_id() {
|
||||
auto rs = co_await qctx->execute_cql(
|
||||
auto rs = co_await execute_cql(
|
||||
format(
|
||||
"SELECT state_id FROM system.{} WHERE key = '{}' LIMIT 1",
|
||||
GROUP0_HISTORY, GROUP0_HISTORY_KEY));
|
||||
|
||||
@@ -454,7 +454,7 @@ public:
|
||||
|
||||
// Get the last (the greatest in timeuuid order) state ID in the group 0 history table.
|
||||
// Assumes that the history table exists, i.e. Raft experimental feature is enabled.
|
||||
static future<utils::UUID> get_last_group0_state_id();
|
||||
future<utils::UUID> get_last_group0_state_id();
|
||||
|
||||
// Checks whether the group 0 history table contains the given state ID.
|
||||
// Assumes that the history table exists, i.e. Raft experimental feature is enabled.
|
||||
|
||||
@@ -117,7 +117,7 @@ future<> group0_state_machine::apply(std::vector<raft::command_cref> command) {
|
||||
|
||||
// max_mutation_size = 1/2 of commitlog segment size, thus max_command_size is set 1/3 of commitlog segment size to leave space for metadata.
|
||||
size_t max_command_size = _sp.data_dictionary().get_config().commitlog_segment_size_in_mb() * 1024 * 1024 / 3;
|
||||
group0_state_machine_merger m(co_await db::system_keyspace::get_last_group0_state_id(), std::move(read_apply_mutex_holder),
|
||||
group0_state_machine_merger m(co_await _client.sys_ks().get_last_group0_state_id(), std::move(read_apply_mutex_holder),
|
||||
max_command_size, _sp.data_dictionary());
|
||||
|
||||
for (auto&& c : command) {
|
||||
|
||||
@@ -249,7 +249,7 @@ future<group0_guard> raft_group0_client::start_operation(seastar::abort_source*
|
||||
// Read barrier may wait for `group0_state_machine::apply` which also takes this mutex.
|
||||
auto read_apply_holder = co_await hold_read_apply_mutex();
|
||||
|
||||
auto observed_group0_state_id = co_await db::system_keyspace::get_last_group0_state_id();
|
||||
auto observed_group0_state_id = co_await _sys_ks.get_last_group0_state_id();
|
||||
auto new_group0_state_id = generate_group0_state_id(observed_group0_state_id);
|
||||
|
||||
co_return group0_guard {
|
||||
|
||||
Reference in New Issue
Block a user