summaryrefslogtreecommitdiff
path: root/src/tutorial
diff options
context:
space:
mode:
authorAmit Kapila2021-05-21 03:01:10 +0000
committerAmit Kapila2021-05-21 03:01:10 +0000
commit71787b23e3dc5510c5bb167abc8a086756811841 (patch)
treebbdd937650814f208656fa3641a90cdfe2ed53fe /src/tutorial
parent0c1b2cb17c2558e4fad897ded1818e465f370973 (diff)
Fix deadlock for multiple replicating truncates of the same table.
While applying the truncate change, the logical apply worker acquires RowExclusiveLock on the relation being truncated. This allowed truncate on the relation at a time by two apply workers which lead to a deadlock. The reason was that one of the workers after updating the pg_class tuple tries to acquire SHARE lock on the relation and started to wait for the second worker which has acquired RowExclusiveLock on the relation. And when the second worker tries to update the pg_class tuple, it starts to wait for the first worker which leads to a deadlock. Fix it by acquiring AccessExclusiveLock on the relation before applying the truncate change as we do for normal truncate operation. Author: Peter Smith, test case by Haiying Tang Reviewed-by: Dilip Kumar, Amit Kapila Backpatch-through: 11 Discussion: https://postgr.es/m/CAHut+PsNm43p0jM+idTvWwiGZPcP0hGrHMPK9TOAkc+a4UpUqw@mail.gmail.com
Diffstat (limited to 'src/tutorial')
0 files changed, 0 insertions, 0 deletions