mirror of https://github.com/postgres/postgres
This patch introduces two additional lock modes for tuples: "SELECT FOR KEY SHARE" and "SELECT FOR NO KEY UPDATE". These don't block each other, in contrast with already existing "SELECT FOR SHARE" and "SELECT FOR UPDATE". UPDATE commands that do not modify the values stored in the columns that are part of the key of the tuple now grab a SELECT FOR NO KEY UPDATE lock on the tuple, allowing them to proceed concurrently with tuple locks of the FOR KEY SHARE variety. Foreign key triggers now use FOR KEY SHARE instead of FOR SHARE; this means the concurrency improvement applies to them, which is the whole point of this patch. The added tuple lock semantics require some rejiggering of the multixact module, so that the locking level that each transaction is holding can be stored alongside its Xid. Also, multixacts now need to persist across server restarts and crashes, because they can now represent not only tuple locks, but also tuple updates. This means we need more careful tracking of lifetime of pg_multixact SLRU files; since they now persist longer, we require more infrastructure to figure out when they can be removed. pg_upgrade also needs to be careful to copy pg_multixact files over from the old server to the new, or at least part of multixact.c state, depending on the versions of the old and new servers. Tuple time qualification rules (HeapTupleSatisfies routines) need to be careful not to consider tuples with the "is multi" infomask bit set as being only locked; they might need to look up MultiXact values (i.e. possibly do pg_multixact I/O) to find out the Xid that updated a tuple, whereas they previously were assured to only use information readily available from the tuple header. This is considered acceptable, because the extra I/O would involve cases that would previously cause some commands to block waiting for concurrent transactions to finish. Another important change is the fact that locking tuples that have previously been updated causes the future versions to be marked as locked, too; this is essential for correctness of foreign key checks. This causes additional WAL-logging, also (there was previously a single WAL record for a locked tuple; now there are as many as updated copies of the tuple there exist.) With all this in place, contention related to tuples being checked by foreign key rules should be much reduced. As a bonus, the old behavior that a subtransaction grabbing a stronger tuple lock than the parent (sub)transaction held on a given tuple and later aborting caused the weaker lock to be lost, has been fixed. Many new spec files were added for isolation tester framework, to ensure overall behavior is sane. There's probably room for several more tests. There were several reviewers of this patch; in particular, Noah Misch and Andres Freund spent considerable time in it. Original idea for the patch came from Simon Riggs, after a problem report by Joel Jacobson. Most code is from me, with contributions from Marti Raudsepp, Alexander Shulgin, Noah Misch and Andres Freund. This patch was discussed in several pgsql-hackers threads; the most important start at the following message-ids: AANLkTimo9XVcEzfiBR-ut3KVNDkjm2Vxh+t8kAmWjPuv@mail.gmail.com 1290721684-sup-3951@alvh.no-ip.org 1294953201-sup-2099@alvh.no-ip.org 1320343602-sup-2290@alvh.no-ip.org 1339690386-sup-8927@alvh.no-ip.org 4FE5FF020200002500048A3D@gw.wicourts.gov 4FEAB90A0200002500048B7D@gw.wicourts.govpull/3/head
parent
f925c79b9f
commit
0ac5ad5134
@ -0,0 +1,17 @@ |
||||
/* contrib/pgrowlocks/pgrowlocks--1.0--1.1.sql */ |
||||
|
||||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION |
||||
\echo Use "CREATE EXTENSION pgrowlocks" to load this file. \quit |
||||
|
||||
ALTER EXTENSION pgrowlocks DROP FUNCTION pgrowlocks(text); |
||||
DROP FUNCTION pgrowlocks(text); |
||||
CREATE FUNCTION pgrowlocks(IN relname text, |
||||
OUT locked_row TID, -- row TID |
||||
OUT locker XID, -- locking XID |
||||
OUT multi bool, -- multi XID? |
||||
OUT xids xid[], -- multi XIDs |
||||
OUT modes text[], -- multi XID statuses |
||||
OUT pids INTEGER[]) -- locker's process id |
||||
RETURNS SETOF record |
||||
AS 'MODULE_PATHNAME', 'pgrowlocks' |
||||
LANGUAGE C STRICT; |
@ -1,14 +1,14 @@ |
||||
/* contrib/pgrowlocks/pgrowlocks--1.0.sql */ |
||||
/* contrib/pgrowlocks/pgrowlocks--1.1.sql */ |
||||
|
||||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION |
||||
\echo Use "CREATE EXTENSION pgrowlocks" to load this file. \quit |
||||
|
||||
CREATE FUNCTION pgrowlocks(IN relname text, |
||||
OUT locked_row TID, -- row TID |
||||
OUT lock_type TEXT, -- lock type |
||||
OUT locker XID, -- locking XID |
||||
OUT multi bool, -- multi XID? |
||||
OUT xids xid[], -- multi XIDs |
||||
OUT modes text[], -- multi XID statuses |
||||
OUT pids INTEGER[]) -- locker's process id |
||||
RETURNS SETOF record |
||||
AS 'MODULE_PATHNAME', 'pgrowlocks' |
@ -1,5 +1,5 @@ |
||||
# pgrowlocks extension |
||||
comment = 'show row-level locking information' |
||||
default_version = '1.0' |
||||
default_version = '1.1' |
||||
module_pathname = '$libdir/pgrowlocks' |
||||
relocatable = true |
||||
|
@ -0,0 +1,139 @@ |
||||
Locking tuples |
||||
-------------- |
||||
|
||||
Locking tuples is not as easy as locking tables or other database objects. |
||||
The problem is that transactions might want to lock large numbers of tuples at |
||||
any one time, so it's not possible to keep the locks objects in shared memory. |
||||
To work around this limitation, we use a two-level mechanism. The first level |
||||
is implemented by storing locking information in the tuple header: a tuple is |
||||
marked as locked by setting the current transaction's XID as its XMAX, and |
||||
setting additional infomask bits to distinguish this case from the more normal |
||||
case of having deleted the tuple. When multiple transactions concurrently |
||||
lock a tuple, a MultiXact is used; see below. This mechanism can accomodate |
||||
arbitrarily large numbers of tuples being locked simultaneously. |
||||
|
||||
When it is necessary to wait for a tuple-level lock to be released, the basic |
||||
delay is provided by XactLockTableWait or MultiXactIdWait on the contents of |
||||
the tuple's XMAX. However, that mechanism will release all waiters |
||||
concurrently, so there would be a race condition as to which waiter gets the |
||||
tuple, potentially leading to indefinite starvation of some waiters. The |
||||
possibility of share-locking makes the problem much worse --- a steady stream |
||||
of share-lockers can easily block an exclusive locker forever. To provide |
||||
more reliable semantics about who gets a tuple-level lock first, we use the |
||||
standard lock manager, which implements the second level mentioned above. The |
||||
protocol for waiting for a tuple-level lock is really |
||||
|
||||
LockTuple() |
||||
XactLockTableWait() |
||||
mark tuple as locked by me |
||||
UnlockTuple() |
||||
|
||||
When there are multiple waiters, arbitration of who is to get the lock next |
||||
is provided by LockTuple(). However, at most one tuple-level lock will |
||||
be held or awaited per backend at any time, so we don't risk overflow |
||||
of the lock table. Note that incoming share-lockers are required to |
||||
do LockTuple as well, if there is any conflict, to ensure that they don't |
||||
starve out waiting exclusive-lockers. However, if there is not any active |
||||
conflict for a tuple, we don't incur any extra overhead. |
||||
|
||||
We provide four levels of tuple locking strength: SELECT FOR KEY UPDATE is |
||||
super-exclusive locking (used to delete tuples and more generally to update |
||||
tuples modifying the values of the columns that make up the key of the tuple); |
||||
SELECT FOR UPDATE is a standards-compliant exclusive lock; SELECT FOR SHARE |
||||
implements shared locks; and finally SELECT FOR KEY SHARE is a super-weak mode |
||||
that does not conflict with exclusive mode, but conflicts with SELECT FOR KEY |
||||
UPDATE. This last mode implements a mode just strong enough to implement RI |
||||
checks, i.e. it ensures that tuples do not go away from under a check, without |
||||
blocking when some other transaction that want to update the tuple without |
||||
changing its key. |
||||
|
||||
The conflict table is: |
||||
|
||||
KEY UPDATE UPDATE SHARE KEY SHARE |
||||
KEY UPDATE conflict conflict conflict conflict |
||||
UPDATE conflict conflict conflict |
||||
SHARE conflict conflict |
||||
KEY SHARE conflict |
||||
|
||||
When there is a single locker in a tuple, we can just store the locking info |
||||
in the tuple itself. We do this by storing the locker's Xid in XMAX, and |
||||
setting infomask bits specifying the locking strength. There is one exception |
||||
here: since infomask space is limited, we do not provide a separate bit |
||||
for SELECT FOR SHARE, so we have to use the extended info in a MultiXact in |
||||
that case. (The other cases, SELECT FOR UPDATE and SELECT FOR KEY SHARE, are |
||||
presumably more commonly used due to being the standards-mandated locking |
||||
mechanism, or heavily used by the RI code, so we want to provide fast paths |
||||
for those.) |
||||
|
||||
MultiXacts |
||||
---------- |
||||
|
||||
A tuple header provides very limited space for storing information about tuple |
||||
locking and updates: there is room only for a single Xid and a small number of |
||||
infomask bits. Whenever we need to store more than one lock, we replace the |
||||
first locker's Xid with a new MultiXactId. Each MultiXact provides extended |
||||
locking data; it comprises an array of Xids plus some flags bits for each one. |
||||
The flags are currently used to store the locking strength of each member |
||||
transaction. (The flags also distinguish a pure locker from an updater.) |
||||
|
||||
In earlier PostgreSQL releases, a MultiXact always meant that the tuple was |
||||
locked in shared mode by multiple transactions. This is no longer the case; a |
||||
MultiXact may contain an update or delete Xid. (Keep in mind that tuple locks |
||||
in a transaction do not conflict with other tuple locks in the same |
||||
transaction, so it's possible to have otherwise conflicting locks in a |
||||
MultiXact if they belong to the same transaction). |
||||
|
||||
Note that each lock is attributed to the subtransaction that acquires it. |
||||
This means that a subtransaction that aborts is seen as though it releases the |
||||
locks it acquired; concurrent transactions can then proceed without having to |
||||
wait for the main transaction to finish. It also means that a subtransaction |
||||
can upgrade to a stronger lock level than an earlier transaction had, and if |
||||
the subxact aborts, the earlier, weaker lock is kept. |
||||
|
||||
The possibility of having an update within a MultiXact means that they must |
||||
persist across crashes and restarts: a future reader of the tuple needs to |
||||
figure out whether the update committed or aborted. So we have a requirement |
||||
that pg_multixact needs to retain pages of its data until we're certain that |
||||
the MultiXacts in them are no longer of interest. |
||||
|
||||
VACUUM is in charge of removing old MultiXacts at the time of tuple freezing. |
||||
This works in the same way that pg_clog segments are removed: we have a |
||||
pg_class column that stores the earliest multixact that could possibly be |
||||
stored in the table; the minimum of all such values is stored in a pg_database |
||||
column. VACUUM computes the minimum across all pg_database values, and |
||||
removes pg_multixact segments older than the minimum. |
||||
|
||||
Infomask Bits |
||||
------------- |
||||
|
||||
The following infomask bits are applicable: |
||||
|
||||
- HEAP_XMAX_INVALID |
||||
Any tuple with this bit set does not have a valid value stored in XMAX. |
||||
|
||||
- HEAP_XMAX_IS_MULTI |
||||
This bit is set if the tuple's Xmax is a MultiXactId (as opposed to a |
||||
regular TransactionId). |
||||
|
||||
- HEAP_XMAX_LOCK_ONLY |
||||
This bit is set when the XMAX is a locker only; that is, if it's a |
||||
multixact, it does not contain an update among its members. It's set when |
||||
the XMAX is a plain Xid that locked the tuple, as well. |
||||
|
||||
- HEAP_XMAX_KEYSHR_LOCK |
||||
- HEAP_XMAX_EXCL_LOCK |
||||
These bits indicate the strength of the lock acquired; they are useful when |
||||
the XMAX is not a MultiXactId. If it's a multi, the info is to be found in |
||||
the member flags. If HEAP_XMAX_IS_MULTI is not set and HEAP_XMAX_LOCK_ONLY |
||||
is set, then one of these *must* be set as well. |
||||
Note there is no infomask bit for a SELECT FOR SHARE lock. Also there is no |
||||
separate bit for a SELECT FOR KEY UPDATE lock; this is implemented by the |
||||
HEAP_KEYS_UPDATED bit. |
||||
|
||||
- HEAP_KEYS_UPDATED |
||||
This bit lives in t_infomask2. If set, indicates that the XMAX updated |
||||
this tuple and changed the key values, or it deleted the tuple. |
||||
It's set regardless of whether the XMAX is a TransactionId or a MultiXactId. |
||||
|
||||
We currently never set the HEAP_XMAX_COMMITTED when the HEAP_XMAX_IS_MULTI bit |
||||
is set. |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,276 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1s s1u s1r s1l s1c s2l s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s1l s2l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s1l s2l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s2l s1l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s2l s1l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s2l s2c s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s1r s1l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s1r s1l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s1r s2c s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s2c s1r s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s1r s1l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s1r s1l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s1r s2c s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s2c s1r s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u: <... completed> |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s2l s2c s1u s1r s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2l s1s s1u s1r s1l s1c s2c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1s s1u s1r s1l s2c s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1s s1u s1r s2c s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1s s1u s2c s1r s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u: <... completed> |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2l s1s s2c s1u s1r s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s2c: COMMIT; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2l s2c s1s s1u s1r s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
@ -0,0 +1,278 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1s s1u s1r s1l s1c s2l s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s1l s2l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s1l s2l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s2l s1l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s2l s1l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s1r s2l s2c s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s1r s1l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s1r s1l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s1r s2c s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s1u s2l s2c s1r s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s1r s1l s1c s2c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s1r s1l s2c s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s1r s2c s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1s s2l s1u s2c s1r s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u: <... completed> |
||||
error in steps s2c s1u: ERROR: could not serialize access due to concurrent update |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1s s2l s2c s1u s1r s1l s1c |
||||
step s1s: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2l s1s s1u s1r s1l s1c s2c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1s s1u s1r s1l s2c s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1s s1u s1r s2c s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1s s1u s2c s1r s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u: <... completed> |
||||
error in steps s2c s1u: ERROR: could not serialize access due to concurrent update |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2l s1s s2c s1u s1r s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1s: SAVEPOINT f; |
||||
step s2c: COMMIT; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2l s2c s1s s1u s1r s1l s1c |
||||
step s2l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1s: SAVEPOINT f; |
||||
step s1u: UPDATE foo SET key = 2; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
@ -0,0 +1,76 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1l s1svp s1d s1r s2l s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: SELECT * FROM foo FOR NO KEY UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1c: COMMIT; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s1svp s1d s2l s1r s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: SELECT * FROM foo FOR NO KEY UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s1c: COMMIT; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s1svp s1d s1r s2l2 s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: SELECT * FROM foo FOR NO KEY UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l2: SELECT * FROM foo FOR NO KEY UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s1svp s1d s2l2 s1r s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: SELECT * FROM foo FOR NO KEY UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l2: SELECT * FROM foo FOR NO KEY UPDATE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l2: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
step s2c: COMMIT; |
@ -0,0 +1,243 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1l s1svp s1d s1r s1c s2l s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1c: COMMIT; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s1svp s1d s1r s2l s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1c: COMMIT; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s1svp s1d s1r s2l s2c s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s1svp s1d s2l s1r s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
step s1c: COMMIT; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s1svp s1d s2l s1r s2c s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1r: ROLLBACK TO f; |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s1svp s1d s2l s2c s1r s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s1svp s2l s1d s1r s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1c: COMMIT; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s1svp s2l s1d s1r s2c s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s1svp s2l s1d s2c s1r s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1d: DELETE FROM foo; |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s1svp s2l s2c s1d s1r s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s2l s1svp s1d s1r s1c s2c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1c: COMMIT; |
||||
step s2l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1l s2l s1svp s1d s1r s2c s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s2l s1svp s1d s2c s1r s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s2l s1svp s2c s1d s1r s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
step s1svp: SAVEPOINT f; |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s1l s2l s2c s1svp s1d s1r s1c |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2l: SELECT * FROM foo FOR UPDATE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1l s1svp s1d s1r s1c s2c |
||||
step s2l: SELECT * FROM foo FOR UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1l s1svp s1d s1r s2c s1c |
||||
step s2l: SELECT * FROM foo FOR UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1l s1svp s1d s2c s1r s1c |
||||
step s2l: SELECT * FROM foo FOR UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1l s1svp s2c s1d s1r s1c |
||||
step s2l: SELECT * FROM foo FOR UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2l s1l s2c s1svp s1d s1r s1c |
||||
step s2l: SELECT * FROM foo FOR UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2l s2c s1l s1svp s1d s1r s1c |
||||
step s2l: SELECT * FROM foo FOR UPDATE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s1svp: SAVEPOINT f; |
||||
step s1d: DELETE FROM foo; |
||||
step s1r: ROLLBACK TO f; |
||||
step s1c: COMMIT; |
@ -0,0 +1,105 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1u1 s1u2 s1c s2u1 s2u2 s2c |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1c: COMMIT; |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1u1 s1u2 s2u1 s1c s2u2 s2c |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; <waiting ...> |
||||
step s1c: COMMIT; |
||||
step s2u1: <... completed> |
||||
error in steps s1c s2u1: ERROR: could not serialize access due to concurrent update |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1u1 s2u1 s1u2 s2u2 s2c s1c |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; <waiting ...> |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2c: COMMIT; |
||||
step s1u2: <... completed> |
||||
error in steps s2c s1u2: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1u1 s2u1 s2u2 s1u2 s2c s1c |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u2: <... completed> |
||||
error in steps s2c s1u2: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1u1 s2u1 s2u2 s2c s1u2 s1c |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2c: COMMIT; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2u1 s1u1 s1u2 s2u2 s2c s1c |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; <waiting ...> |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2c: COMMIT; |
||||
step s1u2: <... completed> |
||||
error in steps s2c s1u2: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2u1 s1u1 s2u2 s1u2 s2c s1c |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u2: <... completed> |
||||
error in steps s2c s1u2: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2u1 s1u1 s2u2 s2c s1u2 s1c |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2c: COMMIT; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2u1 s2u2 s1u1 s1u2 s2c s1c |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u2: <... completed> |
||||
error in steps s2c s1u2: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2u1 s2u2 s1u1 s2c s1u2 s1c |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s2c: COMMIT; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2u1 s2u2 s2c s1u1 s1u2 s1c |
||||
step s2u1: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s2c: COMMIT; |
||||
step s1u1: UPDATE A SET Col1 = 1 WHERE AID = 1; |
||||
step s1u2: UPDATE B SET Col2 = 1 WHERE BID = 2; |
||||
step s1c: COMMIT; |
@ -0,0 +1,67 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1i s1u s1c s2i s2u s2c |
||||
step s1i: INSERT INTO child VALUES (1, 1); |
||||
step s1u: UPDATE parent SET aux = 'bar'; |
||||
step s1c: COMMIT; |
||||
step s2i: INSERT INTO child VALUES (2, 1); |
||||
step s2u: UPDATE parent SET aux = 'baz'; |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1i s1u s2i s1c s2u s2c |
||||
step s1i: INSERT INTO child VALUES (1, 1); |
||||
step s1u: UPDATE parent SET aux = 'bar'; |
||||
step s2i: INSERT INTO child VALUES (2, 1); |
||||
step s1c: COMMIT; |
||||
step s2u: UPDATE parent SET aux = 'baz'; |
||||
ERROR: could not serialize access due to concurrent update |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1i s2i s1u s2u s1c s2c |
||||
step s1i: INSERT INTO child VALUES (1, 1); |
||||
step s2i: INSERT INTO child VALUES (2, 1); |
||||
step s1u: UPDATE parent SET aux = 'bar'; |
||||
step s2u: UPDATE parent SET aux = 'baz'; <waiting ...> |
||||
step s1c: COMMIT; |
||||
step s2u: <... completed> |
||||
error in steps s1c s2u: ERROR: could not serialize access due to concurrent update |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1i s2i s2u s1u s2c s1c |
||||
step s1i: INSERT INTO child VALUES (1, 1); |
||||
step s2i: INSERT INTO child VALUES (2, 1); |
||||
step s2u: UPDATE parent SET aux = 'baz'; |
||||
step s1u: UPDATE parent SET aux = 'bar'; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u: <... completed> |
||||
error in steps s2c s1u: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2i s1i s1u s2u s1c s2c |
||||
step s2i: INSERT INTO child VALUES (2, 1); |
||||
step s1i: INSERT INTO child VALUES (1, 1); |
||||
step s1u: UPDATE parent SET aux = 'bar'; |
||||
step s2u: UPDATE parent SET aux = 'baz'; <waiting ...> |
||||
step s1c: COMMIT; |
||||
step s2u: <... completed> |
||||
error in steps s1c s2u: ERROR: could not serialize access due to concurrent update |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s2i s1i s2u s1u s2c s1c |
||||
step s2i: INSERT INTO child VALUES (2, 1); |
||||
step s1i: INSERT INTO child VALUES (1, 1); |
||||
step s2u: UPDATE parent SET aux = 'baz'; |
||||
step s1u: UPDATE parent SET aux = 'bar'; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1u: <... completed> |
||||
error in steps s2c s1u: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2i s2u s1i s2c s1u s1c |
||||
step s2i: INSERT INTO child VALUES (2, 1); |
||||
step s2u: UPDATE parent SET aux = 'baz'; |
||||
step s1i: INSERT INTO child VALUES (1, 1); |
||||
step s2c: COMMIT; |
||||
step s1u: UPDATE parent SET aux = 'bar'; |
||||
ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
@ -0,0 +1,41 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1d s1c s2i s2c |
||||
step s1d: DELETE FROM A WHERE AID = 1; |
||||
step s1c: COMMIT; |
||||
step s2i: INSERT INTO B (BID,AID,Col2) VALUES (2,1,0); |
||||
ERROR: insert or update on table "b" violates foreign key constraint "b_aid_fkey" |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1d s2i s1c s2c |
||||
step s1d: DELETE FROM A WHERE AID = 1; |
||||
step s2i: INSERT INTO B (BID,AID,Col2) VALUES (2,1,0); <waiting ...> |
||||
step s1c: COMMIT; |
||||
step s2i: <... completed> |
||||
error in steps s1c s2i: ERROR: insert or update on table "b" violates foreign key constraint "b_aid_fkey" |
||||
step s2c: COMMIT; |
||||
|
||||
starting permutation: s1d s2i s2c s1c |
||||
step s1d: DELETE FROM A WHERE AID = 1; |
||||
step s2i: INSERT INTO B (BID,AID,Col2) VALUES (2,1,0); <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2i s1d s1c s2c |
||||
step s2i: INSERT INTO B (BID,AID,Col2) VALUES (2,1,0); |
||||
step s1d: DELETE FROM A WHERE AID = 1; <waiting ...> |
||||
invalid permutation detected |
||||
|
||||
starting permutation: s2i s1d s2c s1c |
||||
step s2i: INSERT INTO B (BID,AID,Col2) VALUES (2,1,0); |
||||
step s1d: DELETE FROM A WHERE AID = 1; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1d: <... completed> |
||||
error in steps s2c s1d: ERROR: update or delete on table "a" violates foreign key constraint "b_aid_fkey" on table "b" |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s2i s2c s1d s1c |
||||
step s2i: INSERT INTO B (BID,AID,Col2) VALUES (2,1,0); |
||||
step s2c: COMMIT; |
||||
step s1d: DELETE FROM A WHERE AID = 1; |
||||
ERROR: update or delete on table "a" violates foreign key constraint "b_aid_fkey" on table "b" |
||||
step s1c: COMMIT; |
@ -0,0 +1,65 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1b s2b s1s s2u s2d s1l s2c s1c |
||||
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ; |
||||
step s2b: BEGIN; |
||||
step s1s: SELECT * FROM foo; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2u: UPDATE foo SET value = 2 WHERE key = 1; |
||||
step s2d: DELETE FROM foo; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1l: <... completed> |
||||
error in steps s2c s1l: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1b s2b s1s s2u s2d s1l s2r s1c |
||||
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ; |
||||
step s2b: BEGIN; |
||||
step s1s: SELECT * FROM foo; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2u: UPDATE foo SET value = 2 WHERE key = 1; |
||||
step s2d: DELETE FROM foo; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s2r: ROLLBACK; |
||||
step s1l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1b s2b s1s s2u s2u2 s1l s2c s1c |
||||
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ; |
||||
step s2b: BEGIN; |
||||
step s1s: SELECT * FROM foo; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2u: UPDATE foo SET value = 2 WHERE key = 1; |
||||
step s2u2: UPDATE foo SET key = 2 WHERE key = 1; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s2c: COMMIT; |
||||
step s1l: <... completed> |
||||
error in steps s2c s1l: ERROR: could not serialize access due to concurrent update |
||||
step s1c: COMMIT; |
||||
|
||||
starting permutation: s1b s2b s1s s2u s2u2 s1l s2r s1c |
||||
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ; |
||||
step s2b: BEGIN; |
||||
step s1s: SELECT * FROM foo; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2u: UPDATE foo SET value = 2 WHERE key = 1; |
||||
step s2u2: UPDATE foo SET key = 2 WHERE key = 1; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; <waiting ...> |
||||
step s2r: ROLLBACK; |
||||
step s1l: <... completed> |
||||
key value |
||||
|
||||
1 1 |
||||
step s1c: COMMIT; |
@ -0,0 +1,18 @@ |
||||
Parsed test spec with 2 sessions |
||||
|
||||
starting permutation: s1b s2b s1s s2u s1l s2c s2d s1c |
||||
step s1b: BEGIN ISOLATION LEVEL REPEATABLE READ; |
||||
step s2b: BEGIN; |
||||
step s1s: SELECT * FROM foo; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2u: UPDATE foo SET value = 2 WHERE key = 1; |
||||
step s1l: SELECT * FROM foo FOR KEY SHARE; |
||||
key value |
||||
|
||||
1 1 |
||||
step s2c: COMMIT; |
||||
step s2d: DELETE FROM foo WHERE key = 1; <waiting ...> |
||||
step s1c: COMMIT; |
||||
step s2d: <... completed> |
@ -0,0 +1,24 @@ |
||||
Parsed test spec with 3 sessions |
||||
|
||||
starting permutation: s1lock s2lock s1svpt s3lock s1lock2 s2c s1c s3c |
||||
step s1lock: SELECT * FROM justthis FOR SHARE; |
||||
value |
||||
|
||||
1 |
||||
step s2lock: SELECT * FROM justthis FOR SHARE; |
||||
value |
||||
|
||||
1 |
||||
step s1svpt: SAVEPOINT foo; |
||||
step s3lock: SELECT * FROM justthis FOR UPDATE; <waiting ...> |
||||
step s1lock2: SELECT * FROM justthis FOR SHARE; |
||||
value |
||||
|
||||
1 |
||||
step s2c: COMMIT; |
||||
step s1c: COMMIT; |
||||
step s3lock: <... completed> |
||||
value |
||||
|
||||
1 |
||||
step s3c: COMMIT; |
@ -0,0 +1,31 @@ |
||||
# When a tuple that has been updated is locked, the locking command |
||||
# should traverse the update chain; thus, a DELETE should not be able |
||||
# to proceed until the lock has been released. |
||||
|
||||
setup |
||||
{ |
||||
CREATE TABLE foo ( |
||||
key int PRIMARY KEY, |
||||
value int |
||||
); |
||||
|
||||
INSERT INTO foo VALUES (1, 1); |
||||
} |
||||
|
||||
teardown |
||||
{ |
||||
DROP TABLE foo; |
||||
} |
||||
|
||||
session "s1" |
||||
setup { BEGIN; } |
||||
step "s1s" { SAVEPOINT f; } |
||||
step "s1u" { UPDATE foo SET key = 2; } # obtain KEY REVOKE |
||||
step "s1r" { ROLLBACK TO f; } # lose KEY REVOKE |
||||
step "s1l" { SELECT * FROM foo FOR KEY SHARE; } |
||||
step "s1c" { COMMIT; } |
||||
|
||||
session "s2" |
||||
setup { BEGIN; } |
||||
step "s2l" { SELECT * FROM foo FOR KEY SHARE; } |
||||
step "s2c" { COMMIT; } |
@ -0,0 +1,34 @@ |
||||
# A funkier version of delete-abort-savept |
||||
setup |
||||
{ |
||||
CREATE TABLE foo ( |
||||
key INT PRIMARY KEY, |
||||
value INT |
||||
); |
||||
|
||||
INSERT INTO foo VALUES (1, 1); |
||||
} |
||||
|
||||
teardown |
||||
{ |
||||
DROP TABLE foo; |
||||
} |
||||
|
||||
session "s1" |
||||
setup { BEGIN; } |
||||
step "s1l" { SELECT * FROM foo FOR KEY SHARE; } |
||||
step "s1svp" { SAVEPOINT f; } |
||||
step "s1d" { SELECT * FROM foo FOR NO KEY UPDATE; } |
||||
step "s1r" { ROLLBACK TO f; } |
||||
step "s1c" { COMMIT; } |
||||
|
||||
session "s2" |
||||
setup { BEGIN; } |
||||
step "s2l" { SELECT * FROM foo FOR UPDATE; } |
||||
step "s2l2" { SELECT * FROM foo FOR NO KEY UPDATE; } |
||||
step "s2c" { COMMIT; } |
||||
|
||||
permutation "s1l" "s1svp" "s1d" "s1r" "s2l" "s1c" "s2c" |
||||
permutation "s1l" "s1svp" "s1d" "s2l" "s1r" "s1c" "s2c" |
||||
permutation "s1l" "s1svp" "s1d" "s1r" "s2l2" "s1c" "s2c" |
||||
permutation "s1l" "s1svp" "s1d" "s2l2" "s1r" "s1c" "s2c" |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue