RE: Parallel scan with SubTransGetTopmostTransaction assert coredump

From: "Pengchengliu" <pengchengliu(at)tju(dot)edu(dot)cn>
To: "'Andres Freund'" <andres(at)anarazel(dot)de>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Parallel scan with SubTransGetTopmostTransaction assert coredump
Date: 2021-05-11 01:27:45
Message-ID: 000601d74604$d8af7570$8a0e6050$
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Andres,
Reproduce steps.

1, Modify and adjust NUM_SUBTRANS_BUFFERS to 128 from 32 in the file "src/include/access/subtrans.h" line number 15.
2, configure with enable assert and build it.
3, init a new database cluster.
4, modify postgres.conf and add some parameters as below. As the coredump from parallel scan, so we adjust parallel setting, make it easy to reproduce.

max_connections = 2000

max_parallel_workers = 32

5, start the database cluster.
6, use the script init_test.sql in attachment to create tables.
7, use pgbench with script sub_120.sql in attachment to test it. Try it sometimes, you should get the coredump file.
pgbench -d postgres -p 33550 -n -r -f sub_120.sql -c 200 -j 200 -T 120


-----Original Message-----
From: Andres Freund <andres(at)anarazel(dot)de>
Sent: 2021年5月7日 11:55
To: Pengchengliu <pengchengliu(at)tju(dot)edu(dot)cn>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Parallel scan with SubTransGetTopmostTransaction assert coredump


On 2021-05-07 11:32:57 +0800, Pengchengliu wrote:
> Hi Hackers,
> Last email, format error, missing some information, so I resend this email.
> With PG 13.2(3fb4c75e857adee3da4386e947ba58a75f3e74b7), I tested subtransaction with parallel scan, I got a subtransaction coredump as below:

> So the root cause is the Parallel Workers process set the TransactionXmin with later transcation snapshot. When parallel scan, Parallel Workers process use the older active snapshot.
> It leads to subtrans assert coredump. I don't know how to fix it. Is there any ideas?

Do you have steps to reliably reproduce this?


Andres Freund

Attachment Content-Type Size
test_script.tar application/x-tar 30.0 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-05-11 01:27:55 Re: Is element access after HASH_REMOVE ever OK?
Previous Message Pengchengliu 2021-05-11 01:26:23 RE: Parallel scan with SubTransGetTopmostTransaction assert coredump