Hello hackers,

A new test isolation/rowtypes-alter produced a failure on buildfarm [1],
seemingly caused by a second parallel worker started despite
max_parallel_workers = 1:
# --- /home/rocky/amphisbaena/buildroot/HEAD/pgsql/src/test/isolation/expected/rowtypes-alter.out 2026-11-11 05:54:57.585807196 +0000 # +++ /home/rocky/amphisbaena/buildroot/HEAD/pgsql.build/testrun/isolation/isolation/results/rowtypes-alter.out 2026-11-11 05:59:39.045730153 +0000
# @@ -150,11 +150,11 @@
#      FROM (SELECT ROW(id, b)::rta_type AS r FROM rta_ptab WHERE id = 1 OFFSET 
0) s;
#   <waiting ...>
#  step s2_alter_type: ALTER TYPE rta_type ALTER ATTRIBUTE b TYPE text;
# +step s3_leader: <... completed>
# +ERROR:  ROW() column has type bytea instead of type text
#  step s2_unlock: SELECT pg_advisory_unlock(1);
#  pg_advisory_unlock
#  ------------------
#  t
#  (1 row)
#
# -step s3_leader: <... completed>
# -ERROR:  row type of datum tuple was altered after the datum's creation
# 1 of 139 tests failed.

I have reproduced this locally with a sleep added inside
LaunchParallelWorkers() (the patch is attached) and with:
printf 'test: rowtypes-alter\n%.0s' `seq 100` > 
src/test/isolation/isolation_schedule
make -s check -C src/test/isolation/
fails for me as below:
...
not ok 99    - rowtypes-alter                            275 ms
ok 100       - rowtypes-alter                            236 ms
1..100
# 35 of 100 tests failed.

postmaster.log (with log_min_messages = DEBUG3 ) contains:
2026-11-11 21:04:14.401 UTC [330022][client backend][17/11:0] LOG: 
!!!ParallelWorkerMain| i: 0, sleep: 92
2026-11-11 21:04:14.401 UTC [330022][client backend][17/11:0] STATEMENT:
            SELECT rta_wait_read(r)
            FROM (SELECT ROW(id, b)::rta_type AS r FROM rta_ptab WHERE id = 1 
OFFSET 0) s;

2026-11-11 21:04:14.401 UTC [329970][postmaster][:0] DEBUG: postmaster received 
pmsignal signal
2026-11-11 21:04:14.401 UTC [329970][postmaster][:0] DEBUG: registering background worker 
"parallel worker for PID 330022"
2026-11-11 21:04:14.401 UTC [329970][postmaster][:0] DEBUG: assigned pm child 
slot 239 for background worker
2026-11-11 21:04:14.401 UTC [329970][postmaster][:0] DEBUG: starting background worker process "parallel worker for PID 330022"
2026-11-11 21:04:14.401 UTC [330023][parallel worker][124/0:0] DEBUG:  
InitPostgres
...
2026-11-11 21:04:14.405 UTC [330023][parallel worker][:0] DEBUG: proc_exit(-1): 
0 callbacks to make
...
2026-11-11 21:04:14.503 UTC [329970][postmaster][:0] DEBUG: starting background worker process "parallel worker for PID 330022"
2026-11-11 21:04:14.503 UTC [330024][parallel worker][125/0:0] DEBUG:  
InitPostgres
2026-11-11 21:04:14.504 UTC [330019][client backend][14/0:0] DEBUG: bind 
<unnamed> to isolationtester_waiting
2026-11-11 21:04:14.504 UTC [330019][client backend][14/30:0] LOG: execute isolationtester_waiting: SELECT pg_catalog.pg_isolation_test_session_is_blocked($1, '{330020,330021,330022}')
2026-11-11 21:04:14.504 UTC [330019][client backend][14/30:0] DETAIL:  
Parameters: $1 = '330022'
2026-11-11 21:04:14.504 UTC [330021][client backend][16/15:0] LOG: statement: ALTER TYPE rta_type ALTER ATTRIBUTE b TYPE text;
2026-11-11 21:04:14.507 UTC [330024][parallel worker][125/6:0] ERROR:  ROW() 
column has type bytea instead of type text


[1] 
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=amphisbaena&dt=2026-11-11%2005%3A54%3A56

Best regards,
Alexander
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index b51df2a4606..ba0a91f44cd 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -645,6 +645,18 @@ LaunchParallelWorkers(ParallelContext *pcxt)
 			shm_mq_detach(pcxt->worker[i].error_mqh);
 			pcxt->worker[i].error_mqh = NULL;
 		}
+if (i == 0)
+{
+instr_time  start, now;
+int msec = rand() % 100;
+elog(LOG, "!!!ParallelWorkerMain| i: %d, sleep: %d", i, msec);
+INSTR_TIME_SET_CURRENT(start);
+do
+{
+pg_usleep(10000); INSTR_TIME_SET_CURRENT(now); INSTR_TIME_SUBTRACT(now, start);
+}
+while (INSTR_TIME_GET_MILLISEC(now) < msec);
+}
 	}
 
 	/*

Reply via email to