Skip to content

Commit

Permalink
fix(cluster): fix slotID in transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
BorysTheDev committed Jan 31, 2024
1 parent 10eda4b commit 9693a3e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,10 @@ void Transaction::InitByKeys(const KeyIndex& key_index) {
unique_shard_cnt_ = 1;
if (is_stub) // stub transactions don't migrate
DCHECK_EQ(unique_shard_id_, Shard(kv_args_.front(), shard_set->size()));
else
else {
unique_slot_checker_.Add(kv_args_.front());
unique_shard_id_ = Shard(kv_args_.front(), shard_set->size());
}

// Multi transactions that execute commands on their own (not stubs) can't shrink the backing
// array, as it still might be read by leftover callbacks.
Expand Down Expand Up @@ -1495,6 +1497,7 @@ void Transaction::LogJournalOnShard(EngineShard* shard, journal::Entry::Payload&
bool is_multi = multi_commands || IsAtomicMulti();

auto opcode = is_multi ? journal::Op::MULTI_COMMAND : journal::Op::COMMAND;
auto slot_id = unique_slot_checker_.GetUniqueSlotId().value_or(-1);
journal->RecordEntry(txid_, opcode, db_index_, shard_cnt, unique_slot_checker_.GetUniqueSlotId(),
std::move(payload), allow_await);
}
Expand Down

0 comments on commit 9693a3e

Please sign in to comment.