Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgHAc-000560-KW for pgsql-hackers@arkaria.postgresql.org; Tue, 11 May 2021 01:26:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lgHAb-0004fZ-IP for pgsql-hackers@arkaria.postgresql.org; Tue, 11 May 2021 01:26:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgHAb-0004fO-A1 for pgsql-hackers@lists.postgresql.org; Tue, 11 May 2021 01:26:45 +0000 Received: from mail-m127148.qiye.163.com ([115.236.127.148]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lgHAQ-0007aP-1c for pgsql-hackers@postgresql.org; Tue, 11 May 2021 01:26:41 +0000 Received: from activesync-3.qy.internal (activesync-3.qy.internal [127.0.0.1]) by mail-m127148.qiye.163.com (Hmail) with ESMTP id B7AF9A80CD9; Tue, 11 May 2021 09:26:23 +0800 (CST) From: "Pengchengliu" To: "'Andres Freund'" Cc: References: <000901d742f1$acae3ad0$060ab070$@tju.edu.cn> <20210507035510.he7e5hiu6dsi4rug@alap3.anarazel.de> <000001d7432b$33cc4a00$9b64de00$@tju.edu.cn> In-Reply-To: <000001d7432b$33cc4a00$9b64de00$@tju.edu.cn> Subject: RE: Parallel scan with SubTransGetTopmostTransaction assert coredump Date: Tue, 11 May 2021 09:26:23 +0800 Message-ID: <000501d74604$a7d5d020$f7817060$@tju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJWZzOrsYDN3Ar+nCJfWwrfcv+5KQKg04GwAjPEpnoBa3FGLamtOo6Q Content-Language: zh-cn X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZGUIZSFYeTUlITE8eTx4fSkpVEwETFhoSFyQUDg9ZV1kWGg8SFR0UWUFZT0tIVUpKS0 hKQ1VLWQY+ X-HM-Sender-Digest: e1kMHhlZQQ8JDh5XWRIfHhUPWUFZRzo3HDoQHDowPw8zPz4JGhQ#IkgX E08JLFVKVUpNSUtNQk1IQ09LTU5VMxYaEhdVCx4VHBgTHhUcFxIOOw8RDlUeHw5VGBVFWVdZEgtZ QVlJSkNVSVVCTFVCSVlXWQgBWUFISExCNwY+ X-HM-Tid: 0a79590841099894kuuub7af9a80cd9 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.=20 max_connections =3D 2000 parallel_setup_cost=3D0 parallel_tuple_cost=3D0 min_parallel_table_scan_size=3D0 max_parallel_workers_per_gather=3D8 max_parallel_workers =3D 32 5, start the database cluster. 6, use the script init_test.sql in attachment to create tables.=20 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 Thanks Pengcheng -----Original Message----- From: Andres Freund =20 Sent: 2021=E5=B9=B45=E6=9C=887=E6=97=A5 11:55 To: Pengchengliu Cc: pgsql-hackers@postgresql.org Subject: Re: Parallel scan with SubTransGetTopmostTransaction assert = coredump Hi, On 2021-05-07 11:32:57 +0800, Pengchengliu wrote: > Hi Hackers=EF=BC=8C >=20 > Last email, format error, missing some information, so I resend this = email. =20 >=20 > 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. >=20 > 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? Greetings, Andres Freund