diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2017-07-26 17:24:16 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2017-07-26 17:25:46 -0400 |
commit | dfd0919855c6a7403bd05e520fb55b290627dbe1 (patch) | |
tree | faeee4015cc2a6e6e6822dc1b408cdc5a2ef6658 /src/backend/access/gist/gistvacuum.c | |
parent | 8ad35c7fa67dec5de61d6fef3500724c49bfc4ce (diff) | |
download | postgresql-dfd0919855c6a7403bd05e520fb55b290627dbe1.tar.gz postgresql-dfd0919855c6a7403bd05e520fb55b290627dbe1.zip |
Fix concurrent locking of tuple update chain
If several sessions are concurrently locking a tuple update chain with
nonconflicting lock modes using an old snapshot, and they all succeed,
it may happen that some of them fail because of restarting the loop (due
to a concurrent Xmax change) and getting an error in the subsequent pass
while trying to obtain a tuple lock that they already have in some tuple
version.
This can only happen with very high concurrency (where a row is being
both updated and FK-checked by multiple transactions concurrently), but
it's been observed in the field and can have unpleasant consequences
such as an FK check failing to see a tuple that definitely exists:
ERROR: insert or update on table "child_table" violates foreign key constraint "fk_constraint_name"
DETAIL: Key (keyid)=(123456) is not present in table "parent_table".
(where the key is observably present in the table).
Discussion: https://postgr.es/m/20170714210011.r25mrff4nxjhmf3g@alvherre.pgsql
Diffstat (limited to 'src/backend/access/gist/gistvacuum.c')
0 files changed, 0 insertions, 0 deletions