Skip to content

Commit 1a29fe2

Browse files
committed
Do not abort prepared transaction when statement is interrupted
In `transaction::abort_or_interupt()` handle the case were a statement is interrupted while transaction is in prepared state. In which case, the transaction must remain in prepared state, until it is committed (or rolled back). Also in this patch: remove check for reduntant `s_must_abort` state.
1 parent 6a17207 commit 1a29fe2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/transaction.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -1400,10 +1400,19 @@ bool wsrep::transaction::abort_or_interrupt(
14001400
}
14011401
return true;
14021402
}
1403-
else if (client_service_.interrupted(lock))
1403+
1404+
if (client_service_.interrupted(lock))
14041405
{
1406+
assert(state() != s_must_abort &&
1407+
state() != s_aborting &&
1408+
state() != s_aborted);
1409+
1410+
// Client was interrupted. Set the appropriate error and abort.
1411+
// For transactions in prepared state, it is OK to interrupt the
1412+
// statement, but transaction must remain in prepared state until
1413+
// commit or rollback.
14051414
client_state_.override_error(wsrep::e_interrupted_error);
1406-
if (state() != s_must_abort)
1415+
if (state() != s_prepared)
14071416
{
14081417
state(lock, s_must_abort);
14091418
}

0 commit comments

Comments
 (0)