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 1lMpkO-0002WJ-IG for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Mar 2021 10:19:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lMpkN-0000h7-Cf for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Mar 2021 10:19:19 +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 1lMpkN-0000h0-6U for pgsql-bugs@lists.postgresql.org; Thu, 18 Mar 2021 10:19:19 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lMpkG-0006ML-Qn for pgsql-bugs@lists.postgresql.org; Thu, 18 Mar 2021 10:19:18 +0000 Received: from hnk.local (p2350207-ipbf2126funabasi.chiba.ocn.ne.jp [114.167.184.207]) by oss.nttdata.com (Postfix) with ESMTPSA id 6FFC962800; Thu, 18 Mar 2021 19:19:10 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: BUG #16931: source code problem about commit_ts To: zoulx1982@163.com, pgsql-bugs@lists.postgresql.org References: <16931-620d0f2fdc6108f1@postgresql.org> From: Fujii Masao Message-ID: Date: Thu, 18 Mar 2021 19:19:10 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <16931-620d0f2fdc6108f1@postgresql.org> Content-Type: multipart/mixed; boundary="------------4ACEC3C87275BDF41E290A5A" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------4ACEC3C87275BDF41E290A5A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 2021/03/18 13:36, PG Bug reporting form wrote: > The following bug has been logged on the website: > > Bug reference: 16931 > Logged by: lx zou > Email address: zoulx1982@163.com > PostgreSQL version: 13.2 > Operating system: Linux > Description: > > Hi, > recently i am reading commit ts code, and i have a problem about it. > i found commit_ts_redo call TransactionTreeSetCommitTsData with last param > `write_xlog` true, > but RecordTransactionCommitPrepared and RecordTransactionCommit call > TransactionTreeSetCommitTsData > with `write_xlog` false, which cause there are never xlog with commit_ts - > COMMIT_TS_SETTS type. > thanks for your time. I guess that TransactionTreeSetCommitTsData(write_xlog=true) is basically used by some extensions using commit_ts. IIUC commit_ts_redo() is called during recovery. So it's strange that commit_ts_redo() calls TransactionTreeSetCommitTsData() with write_xlog=true because no new WAL can be generated during recovery. Probably this is a bug, and it should be called with write_xlog=false, instead. Patch attached. Also one problem is that there is no test for WAL replay of COMMIT_TS_SETTS for now. Maybe this is why we could not find that bug. Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION --------------4ACEC3C87275BDF41E290A5A Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="bugfix.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bugfix.patch" ZGlmZiAtLWdpdCBhL3NyYy9iYWNrZW5kL2FjY2Vzcy90cmFuc2FtL2NvbW1pdF90cy5jIGIv c3JjL2JhY2tlbmQvYWNjZXNzL3RyYW5zYW0vY29tbWl0X3RzLmMKaW5kZXggNDhlOGQ2NjI4 Ni4uMjY4YmRiYTMzOSAxMDA2NDQKLS0tIGEvc3JjL2JhY2tlbmQvYWNjZXNzL3RyYW5zYW0v Y29tbWl0X3RzLmMKKysrIGIvc3JjL2JhY2tlbmQvYWNjZXNzL3RyYW5zYW0vY29tbWl0X3Rz LmMKQEAgLTEwNzQsNyArMTA3NCw3IEBAIGNvbW1pdF90c19yZWRvKFhMb2dSZWFkZXJTdGF0 ZSAqcmVjb3JkKQogCQkJc3VieGlkcyA9IE5VTEw7CiAKIAkJVHJhbnNhY3Rpb25UcmVlU2V0 Q29tbWl0VHNEYXRhKHNldHRzLT5tYWlueGlkLCBuc3VieGlkcywgc3VieGlkcywKLQkJCQkJ CQkJCSAgIHNldHRzLT50aW1lc3RhbXAsIHNldHRzLT5ub2RlaWQsIHRydWUpOworCQkJCQkJ CQkJICAgc2V0dHMtPnRpbWVzdGFtcCwgc2V0dHMtPm5vZGVpZCwgZmFsc2UpOwogCQlpZiAo c3VieGlkcykKIAkJCXBmcmVlKHN1YnhpZHMpOwogCX0K --------------4ACEC3C87275BDF41E290A5A--