From 31e9cf0d847315da3c2300a3917ca857e3fab0cc Mon Sep 17 00:00:00 2001 From: Vladislav Oleshko Date: Tue, 24 Jan 2023 14:03:32 +0300 Subject: [PATCH] fix(server): Fix multi tx cleanup Signed-off-by: Vladislav Oleshko --- src/server/transaction.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/transaction.cc b/src/server/transaction.cc index df7e6465da55..913808080307 100644 --- a/src/server/transaction.cc +++ b/src/server/transaction.cc @@ -1103,15 +1103,15 @@ void Transaction::UnlockMultiShardCb(const std::vector& sharded_keys, E // It does not have to be that all shards in multi transaction execute this tx. // Hence it could stay in the tx queue. We perform the necessary cleanup and remove it from - // there. + // there. The transaction is not guaranteed to be at front. if (sd.pq_pos != TxQueue::kEnd) { - DVLOG(1) << "unlockmulti: TxPopFront " << DebugId(); + DVLOG(1) << "unlockmulti: TxRemove " << DebugId(); TxQueue* txq = shard->txq(); DCHECK(!txq->Empty()); - Transaction* trans = absl::get(txq->Front()); - DCHECK(trans == this) << "Front: " << trans->DebugId(); - txq->PopFront(); + DCHECK_EQ(absl::get(txq->At(sd.pq_pos)), this); + + txq->Remove(sd.pq_pos); sd.pq_pos = TxQueue::kEnd; }