mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
lwt: make load_paxos_state to take partition_key_view instead of a deference
Some caller have partition_key_view, but not partition_key, so thy need to create a temporary and copy just to pass a reference. Change it by accepting a view.
This commit is contained in:
@@ -2190,13 +2190,13 @@ future<std::vector<view_build_progress>> load_view_build_progress() {
|
||||
});
|
||||
}
|
||||
|
||||
future<service::paxos::paxos_state> load_paxos_state(const partition_key& key, schema_ptr s, gc_clock::time_point now,
|
||||
future<service::paxos::paxos_state> load_paxos_state(partition_key_view key, schema_ptr s, gc_clock::time_point now,
|
||||
db::timeout_clock::time_point timeout) {
|
||||
static auto cql = format("SELECT * FROM system.{} WHERE row_key = ? AND cf_id = ?", PAXOS);
|
||||
// FIXME: we need execute_cql_with_now()
|
||||
(void)now;
|
||||
auto f = execute_cql_with_timeout(cql, timeout, to_legacy(*key.get_compound_type(*s), key.representation()), s->id());
|
||||
return f.then([s, key] (shared_ptr<cql3::untyped_result_set> results) mutable {
|
||||
return f.then([s, key = std::move(key)] (shared_ptr<cql3::untyped_result_set> results) mutable {
|
||||
if (results->empty()) {
|
||||
return service::paxos::paxos_state();
|
||||
}
|
||||
|
||||
@@ -642,7 +642,7 @@ future<std::vector<view_name>> load_built_views();
|
||||
future<std::vector<view_build_progress>> load_view_build_progress();
|
||||
|
||||
// Paxos related functions
|
||||
future<service::paxos::paxos_state> load_paxos_state(const partition_key& key, schema_ptr s, gc_clock::time_point now,
|
||||
future<service::paxos::paxos_state> load_paxos_state(partition_key_view key, schema_ptr s, gc_clock::time_point now,
|
||||
db::timeout_clock::time_point timeout);
|
||||
future<> save_paxos_promise(const schema& s, const partition_key& key, const utils::UUID& ballot, db::timeout_clock::time_point timeout);
|
||||
future<> save_paxos_proposal(const schema& s, const service::paxos::proposal& proposal, db::timeout_clock::time_point timeout);
|
||||
|
||||
@@ -127,8 +127,7 @@ future<bool> paxos_state::accept(tracing::trace_state_ptr tr_state, schema_ptr s
|
||||
|
||||
return with_locked_key(token, timeout, [&proposal, schema, tr_state, timeout] () mutable {
|
||||
auto now_in_sec = utils::UUID_gen::unix_timestamp_in_sec(proposal.ballot);
|
||||
auto f = db::system_keyspace::load_paxos_state(proposal.update.decorated_key(*schema).key(), schema,
|
||||
gc_clock::time_point(now_in_sec), timeout);
|
||||
auto f = db::system_keyspace::load_paxos_state(proposal.update.key(), schema, gc_clock::time_point(now_in_sec), timeout);
|
||||
return f.then([&proposal, tr_state, schema, timeout] (paxos_state state) {
|
||||
return utils::get_local_injector().inject("paxos_state_accept_timeout", timeout).then(
|
||||
[&proposal, state = std::move(state), tr_state, schema, timeout] {
|
||||
|
||||
Reference in New Issue
Block a user