Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSBFg-0001yr-IF for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Nov 2019 02:40:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iSBFf-0006vF-AK for pgsql-bugs@arkaria.postgresql.org; Wed, 06 Nov 2019 02:40:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iSBFe-0006v7-VD for pgsql-bugs@lists.postgresql.org; Wed, 06 Nov 2019 02:40:55 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iSBFc-00075R-2d for pgsql-bugs@lists.postgresql.org; Wed, 06 Nov 2019 02:40:54 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 7743221C3FA6 for ; Wed, 6 Nov 2019 05:40:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.0.108] (pool-77-222-104-35.is74.ru [77.222.104.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 43EB221C3F9F for ; Wed, 6 Nov 2019 05:40:50 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1573008050; bh=y/vSizCA61o55Me1JVMHDjM+F2R2fx/dDyNfGHIkEwI=; h=From:Subject:To:Date; b=EF9mDC2ItYy9ZrKRzcTRuSRJVLEdvnS4l+VjL4zDhllW6Wah0mLt2P22hTg1GP1Kz deuhg/4cUvKxdiR6Nh+8HD/k6bfZObvDLLSFbLVujNouTGsP8BQQ5XotPfXFC7wdhm 6Pt75G9GGyuciwhl55Zlbx18yLkpc6UsK/MbqTZ0= From: Andrey Lepikhov Subject: The XLogFindNextRecord() routine find incorrect record start point after a long continuation record Organization: Postgres Professional To: PostgreSQL mailing lists Message-ID: <99303554-5dd5-06e6-f943-b3005ccd6edd@postgrespro.ru> Date: Wed, 6 Nov 2019 07:40:48 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------555AA469CDF1ED3647433C37" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------555AA469CDF1ED3647433C37 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit I found this in our multimaster project on PostgreSQL 11.5. It is difficult to reproduce this error, but I will try to do it if necessary. The rest of a continuation WAL-record can exactly match the block size. In this case, we need to switch targetPagePtr to the next block before calculating the starting point of the next WAL-record. See the patch in attachment for the bug fix. -- Andrey Lepikhov Postgres Professional https://postgrespro.com The Russian Postgres Company --------------555AA469CDF1ED3647433C37 Content-Type: text/x-patch; name="0001-Correct-the-algorithm-of-definition-of-WAL-record-st.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Correct-the-algorithm-of-definition-of-WAL-record-st.pa"; filename*1="tch"