Test equivclass interferes with tests tsearch and advisory_lock

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Test equivclass interferes with tests tsearch and advisory_lock
Date: 2024-05-06 09:00:00
Message-ID: 4d6cd371-480f-1c40-1ed0-9624baca67af@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

While trying to catch a sporadic regression test failure, I've discovered
that tests tsearch and advisory_lock in the parallel_schedule's group:
test: select_views ...  tsearch ... advisory_lock indirect_toast equivclass

might fail, depending on timing, because the test equivclass creates and
drops int alias operators.

With the attached patch applied to make tests in question repeatable, the
following test run fails for me:
(printf 'test: test_setup\n'; \
 printf 'test: tsearch equivclass %.0s\n' `seq 300`}) >/tmp/test_schedule;
make -s check-tests TESTS="--schedule=/tmp/test_schedule"
...
# 17 of 601 tests failed.

regression.diffs contains:
diff -U3 .../src/test/regress/expected/tsearch.out .../src/test/regress/results/tsearch.out
--- .../src/test/regress/expected/tsearch.out       2024-05-06 08:11:54.892649407 +0000
+++ .../src/test/regress/results/tsearch.out        2024-05-06 08:13:35.514113420 +0000
@@ -16,10 +16,7 @@
 WHERE prsnamespace = 0 OR prsstart = 0 OR prstoken = 0 OR prsend = 0 OR
       -- prsheadline is optional
       prslextype = 0;
- oid | prsname
------+---------
-(0 rows)
-
+ERROR:  cache lookup failed for type 18517
 SELECT oid, dictname
...

Or with advisory_lock:
(printf 'test: test_setup\n'; \
 printf 'test: advisory_lock equivclass %.0s\n' `seq 300`}) >/tmp/test_schedule;
make -s check-tests TESTS="--schedule=/tmp/test_schedule"
...
# 1 of 601 tests failed.

regression.diffs contains:
diff -U3 .../src/test/regress/expected/advisory_lock.out .../src/test/regress/results/advisory_lock.out
--- .../src/test/regress/expected/advisory_lock.out 2024-04-10 14:36:57.709586678 +0000
+++ .../src/test/regress/results/advisory_lock.out  2024-05-06 08:15:09.235456794 +0000
@@ -14,40 +14,17 @@
 SELECT locktype, classid, objid, objsubid, mode, granted
        FROM pg_locks WHERE locktype = 'advisory' AND database = :datoid
        ORDER BY classid, objid, objsubid;
- locktype | classid | objid | objsubid |     mode      | granted
-----------+---------+-------+----------+---------------+---------
- advisory |       0 |     1 |        1 | ExclusiveLock | t
- advisory |       0 |     2 |        1 | ShareLock     | t
- advisory |       1 |     1 |        2 | ExclusiveLock | t
- advisory |       2 |     2 |        2 | ShareLock     | t
-(4 rows)
-
+ERROR:  cache lookup failed for type 17976
 -- pg_advisory_unlock_all() shouldn't release xact locks
...

With backtrace_functions = 'getBaseTypeAndTypmod' specified,
I see the following stack trace of the error:
2024-05-06 08:30:51.344 UTC client backend[869479] pg_regress/tsearch ERROR:  cache lookup failed for type 18041
2024-05-06 08:30:51.344 UTC client backend[869479] pg_regress/tsearch BACKTRACE:
getBaseTypeAndTypmod at lsyscache.c:2550:4
getBaseType at lsyscache.c:2526:1
find_coercion_pathway at parse_coerce.c:3131:18
can_coerce_type at parse_coerce.c:598:6
func_match_argtypes at parse_func.c:939:6
oper_select_candidate at parse_oper.c:327:5
oper at parse_oper.c:428:6
make_op at parse_oper.c:696:30
transformBoolExpr at parse_expr.c:1431:9
 (inlined by) transformExprRecurse at parse_expr.c:226:13
transformExpr at parse_expr.c:133:22
transformWhereClause at parse_clause.c:1867:1
transformSelectStmt at analyze.c:1382:20
 (inlined by) transformStmt at analyze.c:368:15
parse_analyze_fixedparams at analyze.c:110:15
pg_analyze_and_rewrite_fixedparams at postgres.c:691:5
 (inlined by) exec_simple_query at postgres.c:1190:20
PostgresMain at postgres.c:4680:7
BackendMain at backend_startup.c:61:2

Best regards,
Alexander

Attachment Content-Type Size
make-tests-tsearch+equivclass-repeatable.patch text/x-patch 1.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-05-06 09:23:57 Re: TerminateOtherDBBackends code comments inconsistency.
Previous Message Andy Fan 2024-05-06 07:48:10 Re: UniqueKey v2