pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] Fix isolation test to be less timing-dependent
2+ messages / 2 participants
[nested] [flat]

* [PATCH] Fix isolation test to be less timing-dependent
@ 2018-01-03 14:16  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2018-01-03 14:16 UTC (permalink / raw)

I did this by adding another locking process, which makes the other two
wait.  This way the output should be stable enough.  However, it means
isolationtester older than 9.6 is unable to run this test, so remove it.

Per buildfarm and Andres Freund
Discussion: https://postgr.es/m/20180103034445.t3utrtrnrevfsghm@alap3.anarazel.de
---
 src/test/isolation/expected/multiple-cic.out | 17 +++++++++++------
 src/test/isolation/specs/multiple-cic.spec   | 12 ++++++++----
 2 files changed, 19 insertions(+), 10 deletions(-)

inline patch 1: src/test/isolation/expected/multiple-cic.out, src/test/isolation/specs/multiple-cic.spec (+19/-10 lines) download inline-1.patchdiff --git a/src/test/isolation/expected/multiple-cic.out b/src/test/isolation/expected/multiple-cic.out index cc57940392..0b470e7d1d 100644 --- a/src/test/isolation/expected/multiple-cic.out +++ b/src/test/isolation/expected/multiple-cic.out @@ -1,6 +1,9 @@ -Parsed test spec with 2 sessions +Parsed test spec with 3 sessions -starting permutation: s2l s1i s2i +starting permutation: s2l s1i s2i s3u +pg_advisory_lock + + step s2l: SELECT pg_advisory_lock(281457); pg_advisory_lock @@ -11,9 +14,11 @@ step s1i: <waiting ...> step s2i: CREATE INDEX CONCURRENTLY mcic_two_pkey ON mcic_two (id) - WHERE unlck(); + WHERE unlck() AND lck_shr(572814); + <waiting ...> +step s3u: SELECT unlck(); +unlck +t step s1i: <... completed> -s1 - - +step s2i: <... completed> diff --git a/src/test/isolation/specs/multiple-cic.spec b/src/test/isolation/specs/multiple-cic.spec index a7ba4eb4fd..fbec67ee25 100644 --- a/src/test/isolation/specs/multiple-cic.spec +++ b/src/test/isolation/specs/multiple-cic.spec @@ -26,15 +26,19 @@ session "s1" step "s1i" { CREATE INDEX CONCURRENTLY mcic_one_pkey ON mcic_one (id) WHERE lck_shr(281457); - } -teardown { SELECT pg_advisory_unlock_all() AS "s1"; } +} +step "s1u" { SELECT unlck(); } session "s2" step "s2l" { SELECT pg_advisory_lock(281457); } step "s2i" { CREATE INDEX CONCURRENTLY mcic_two_pkey ON mcic_two (id) - WHERE unlck(); + WHERE unlck() AND lck_shr(572814); } -permutation "s2l" "s1i" "s2i" +session "s3" +setup { SELECT pg_advisory_lock(572814); } +step "s3u" { SELECT unlck(); } + +permutation "s2l" "s1i" "s2i" "s3u" -- 2.11.0
--jv4db6vu2dvcufcq-- ^ permalink raw reply [nested|flat] 2+ messages in thread

* pgsql: Don't error out when dropping constraint if relchecks is already
@ 2025-10-28 18:14  Álvaro Herrera <alvherre@kurilemu.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Álvaro Herrera @ 2025-10-28 18:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't error out when dropping constraint if relchecks is already zero

I have never seen this be a problem in practice, but it came up when
purposely corrupting catalog contents to study the fix for a nearby bug:
we'd try to decrement relchecks, but since it's zero we error out and
fail to drop the constraint.  The fix is to downgrade the error to
warning, skip decrementing the counter, and otherwise proceed normally.

Given lack of field complaints, no backpatch.

Author: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/202508291058.q2zscdcs64fj@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d5845aa8adb25fda30cb2ad44aa2c5b0a59baa27

Modified Files
--------------
src/backend/catalog/pg_constraint.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-10-28 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-03 14:16 [PATCH] Fix isolation test to be less timing-dependent Alvaro Herrera <alvherre@alvh.no-ip.org>
2025-10-28 18:14 pgsql: Don't error out when dropping constraint if relchecks is already Álvaro Herrera <alvherre@kurilemu.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox