| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Noah Misch <noah(at)leadboat(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, vignesh21(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: sequencesync worker race with REFRESH SEQUENCES |
| Date: | 2026-07-16 00:51:10 |
| Message-ID: | 3614163.1784163070@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
BF member skink (uses valgrind) has failed
subscription/t/036_sequences.pl twice since f38afa4ab went in.
I can reproduce that locally if I run the postmaster under valgrind.
However, valgrind isn't issuing any complaint AFAICT. It looks like
valgrind simply slows things down enough to expose a race condition.
What is in my subscriber's log is
...
2026-07-15 20:29:08.328 EDT client backend[3612746] 036_sequences.pl LOG: statement: ALTER SUBSCRIPTION regress_seq_sub REFRESH SEQUENCES
2026-07-15 20:29:09.083 EDT logical replication sequencesync worker[3612758] LOG: logical replication sequence synchronization worker for subscription "regress_seq_sub" has started
2026-07-15 20:29:10.095 EDT logical replication sequencesync worker[3612758] WARNING: insufficient privileges on publisher sequence ("public.regress_s2")
2026-07-15 20:29:10.095 EDT logical replication sequencesync worker[3612758] HINT: Grant SELECT on the sequence to the role used for the replication connection on the publisher.
2026-07-15 20:29:10.097 EDT logical replication sequencesync worker[3612758] ERROR: logical replication sequence synchronization failed for subscription "regress_seq_sub"
2026-07-15 20:29:10.274 EDT postmaster[3612613] LOG: background worker "logical replication sequencesync worker" (PID 3612758) exited with exit code 1
2026-07-15 20:29:10.501 EDT logical replication sequencesync worker[3612763] LOG: logical replication sequence synchronization worker for subscription "regress_seq_sub" has started
2026-07-15 20:29:10.814 EDT client backend[3612766] 036_sequences.pl LOG: statement: ALTER SUBSCRIPTION regress_seq_sub REFRESH SEQUENCES
2026-07-15 20:29:10.837 EDT client backend[3612766] 036_sequences.pl ERROR: cannot execute ALTER SUBSCRIPTION ... REFRESH SEQUENCES while a sequence synchronization worker is running
2026-07-15 20:29:10.837 EDT client backend[3612766] 036_sequences.pl HINT: Try again after the current synchronization completes.
2026-07-15 20:29:10.837 EDT client backend[3612766] 036_sequences.pl STATEMENT: ALTER SUBSCRIPTION regress_seq_sub REFRESH SEQUENCES
That is, after checking for the "insufficient privileges" case,
we aren't waiting long enough for the new seqsync worker to quiesce.
This wasn't a problem before f38afa4ab, because it wasn't an error
condition for that worker to still be running.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-07-16 01:08:17 | Re: pgstat: add pgstat_prep_pending() for entry ref pending setup |
| Previous Message | Paul A Jungwirth | 2026-07-16 00:26:27 | Re: Fix RLS checks for UPDATE/DELETE FOR PORTION OF leftover rows |