[PATCH] Fix alter subscription concurrency errors

From: Jelte Fennema <Jelte(dot)Fennema(at)microsoft(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: [PATCH] Fix alter subscription concurrency errors
Date: 2022-08-25 14:47:26
Message-ID: HE1PR8303MB0075BF78AF1BE904050DA16BF7729@HE1PR8303MB0075.EURPRD83.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Without this patch concurrent ALTER/DROP SUBSCRIPTION statements for
the same subscription could result in one of these statements returning the
following error:

ERROR: XX000: tuple concurrently updated

This patch fixes that by re-fetching the tuple after acquiring the lock on the
subscription. The included isolation test fails most of its permutations
without this patch, with the error shown above.

The loop to re-fetch the tuple is heavily based on the code from dbcommands.c

Attachment Content-Type Size
0001-Fix-errors-when-concurrently-altering-subscriptions.patch application/octet-stream 10.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-08-25 14:48:35 Re: pg_regress: lookup shellprog in $PATH
Previous Message Robert Haas 2022-08-25 14:35:20 Re: pg_basebackup: add test about zstd compress option