| From: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
|---|---|
| To: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org, Ajin Cherian <itsajin(at)gmail(dot)com>, imchifan8(at)gmail(dot)com, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shvetamalik(at)gmail(dot)com> |
| Subject: | Re: BUG #19864: pg_get_publication_tables() gets cache lookup error after concurrent DROP PUBLICATION |
| Date: | 2026-11-13 09:31:17 |
| Message-ID: | CAN4CZFPggSOzFHNxah3s8E17HH5TJU1c6Oj-xAQy2TCUNvi-jw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hello
There's still another remaining issue with the above patches, pointed
out by claude: a missing pg_publication_rel entry while the
publication still exists isn't always the partition-via-parent case,
the table could also have been removed from the publication
concurrently.
CREATE TABLE t (a int, b int, c int);
CREATE PUBLICATION p FOR TABLE t (a, b) WHERE (a > 5);
s1: BEGIN; LOCK t IN ACCESS EXCLUSIVE MODE;
s2: SELECT relid::regclass, attrs, pg_get_expr(qual, relid) FROM
pg_get_publication_tables('p'); -- blocks
s1: ALTER PUBLICATION p DROP TABLE t; COMMIT;
-- s2: t | 1 2 3 | (null)
With multiple publications, a full testcase:
setup
{
CREATE TABLE pubfilt (a int, b int, c int);
CREATE PUBLICATION p1 FOR TABLE pubfilt WHERE (a > 5);
CREATE PUBLICATION p2 FOR TABLE pubfilt WHERE (b > 2);
}
teardown
{
DROP PUBLICATION p1, p2;
DROP TABLE pubfilt;
}
session s1
step lock { BEGIN; LOCK pubfilt IN ACCESS EXCLUSIVE MODE; }
step unlock { COMMIT; }
step alter_and_commit { ALTER PUBLICATION p2 DROP TABLE pubfilt; COMMIT; }
session s2
step tablesync_qual
{
SELECT DISTINCT pg_get_expr(gpt.qual, gpt.relid) AS rowfilter
FROM pg_get_publication_tables(ARRAY['p1','p2'], 'pubfilt'::regclass) gpt
ORDER BY 1;
}
permutation lock tablesync_qual unlock
permutation lock tablesync_qual alter_and_commit
Maybe the miss branch could also check
is_table_publishable_in_publication(relid, pub) after the
PUBLICATIONOID check, and skip the row if the table isn't published
anymore? Something like:
+ if (!HeapTupleIsValid(pubtuple) &&
+ !is_table_publishable_in_publication(relid, pub))
+ {
+ table_close(rel, AccessShareLock);
+ continue;
+ }
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-11-13 09:33:46 | Re: BUG #19896: transaction_timeout misbehaves after ROLLBACK TO SAVEPOINT and after errors |
| Previous Message | shveta malik | 2026-11-13 08:42:17 | Re: BUG #19864: pg_get_publication_tables() gets cache lookup error after concurrent DROP PUBLICATION |