Consider the following scenario where we have a table t(k int primary key, v int), with record (1,1),(2,2)
begin;
update t set v=v+1 where k=1;
insert into t values (2,2); // this fails, and the subtxn is rolled back
all commands after this point fail with the following error until an explicit commit/rollback is issued.
current transaction is aborted, commands ignored until end of transaction block
but the transaction itself isn't being aborted. when we know it is eventually going to be aborted, we could early abort it as well. That way other txns waiting to acquire locks on k=1 would be unblocked early. (Can also perform txn related cleanup early).
More detials:
We early abort the transactions in a couple of cases
We look at the passed status alone while making this decision at client/transaction.cc. But it looks like for a couple of errors, we just populate the error in the op's response and pass Status::OK() as a result to Flush.
For instance,
Jira Link: DB-10554
Description
Consider the following scenario where we have a table
t(k int primary key, v int)
, with record(1,1),(2,2)
all commands after this point fail with the following error until an explicit
commit
/rollback
is issued.but the transaction itself isn't being aborted. when we know it is eventually going to be aborted, we could early abort it as well. That way other txns waiting to acquire locks on
k=1
would be unblocked early. (Can also perform txn related cleanup early).More detials: We early abort the transactions in a couple of cases
We look at the passed
status
alone while making this decision atclient/transaction.cc
. But it looks like for a couple of errors, we just populate the error in theop
's response and passStatus::OK()
as a result toFlush
. For instance,the op has an error code
PGSQL_STATUS_DUPLICATE_KEY_ERROR
, but the status is stillOK
, which leads to the above problem.cc @pkj415
Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information