Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s5eqE-0078lW-EQ for pgsql-hackers@arkaria.postgresql.org; Sat, 11 May 2024 05:00:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s5eqA-003Xtt-BP for pgsql-hackers@arkaria.postgresql.org; Sat, 11 May 2024 05:00:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s5eq9-003Xtl-VU for pgsql-hackers@lists.postgresql.org; Sat, 11 May 2024 05:00:10 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s5eq2-000Se6-V6 for pgsql-hackers@postgresql.org; Sat, 11 May 2024 05:00:09 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-51f3761c96aso3205916e87.3 for ; Fri, 10 May 2024 22:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715403602; x=1716008402; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bpz4JJ2qaRRUYwmoe3orpy0nhBwcyVsjLkahoCQz/L4=; b=c44PYxJ5fq0AW4fNcJDpPf4RgasMSF4s+sRBOFmVAXnJVqQIJO2O2n2Mn2MwyDisp3 ntPM6Nc0eCsmwH6V2zyGMzmq13EIX/EAwuxbA1HRj6g++JGzsTSjqPeXoG8c71cLaGIz imB+hw8anVExwk2FR3aD+UKuSRH7iwlFZx/9rmcttMDajKwA9pJcxDrWSqwTN+hELRHs i9yZk42eSAjVZtObMZmETa+1fG/1gnWB9zS3T4c24EKA7T50gsdLuvTSKql7iSLq1Hw6 YdIx/zENbaXSt3S2YSP0/MTIztQ1q9Po/txx5mMdx56Lw95Q4aC1abLSxonm+4TeTkeG jHKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715403602; x=1716008402; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bpz4JJ2qaRRUYwmoe3orpy0nhBwcyVsjLkahoCQz/L4=; b=BngsP1JZID/EatiMYLe56nEBwa84iPJeVGJD5UYu3pdR9Km6jIopWgvRqJjwI0qVF9 2U77r2z1YfHNHLUKFQ1bwgpuuS25iqOYj5/vjsxHjYYrGvEeCnvA8rMfOAhS3s3TReJV 0Mmf1qghMr3Y297T2myJYfL9eABZWcENEg6xsMfHBqdhv368cmB7Gq7f+Ow3aXObcXb8 s3BLE2GQimS8+lklGuMIjc+89WEeDpNoqSpYsmVDn0CQ8n2hujJvSdAYdva4ipCgJhD+ va9dTZWeiHL52CCoDR8Qq/Px3g8rlWVwEEwTE84mbHE0gcTz6j78Ak4a1VqrO5pw5W7Z DHGg== X-Forwarded-Encrypted: i=1; AJvYcCX9xbwZU5cAIonl3wi9rl8euj14dz4ME+IxgIuv0p+OeXPTXEklLkp0rptaR8RqX9sz4VfjmW6tyhJvXFCBPrRAWY0Nz3NMaF2jiYdB X-Gm-Message-State: AOJu0Yy7aNy8LY8KuWss90vAQXSPmhZd1iKKOxkVLJNUjInJSaFEanoP UrIg4u2wJPT8p/TeiyrCCkhUaeZJRUwRy5zTJWDnlg5xxNZDaozs X-Google-Smtp-Source: AGHT+IF1YDl6hr2YZ70iCRCvnqpgXfQEUf6b0BubObH3XWAMXVhseRX0TRN5643+ryoAijgY7g3xAg== X-Received: by 2002:ac2:5331:0:b0:51d:a8ce:540 with SMTP id 2adb3069b0e04-5220fd7bb24mr3568354e87.35.1715403601846; Fri, 10 May 2024 22:00:01 -0700 (PDT) Received: from [1.0.0.7] ([178.155.25.230]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-521f35ae015sm899116e87.55.2024.05.10.22.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 May 2024 22:00:01 -0700 (PDT) Message-ID: <35e2c2f8-f65a-f93a-ea23-957bb67a2d42@gmail.com> Date: Sat, 11 May 2024 08:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: WAL record CRC calculated incorrectly because of underlying buffer modification Content-Language: en-US To: Thomas Munro Cc: Andres Freund , pgsql-hackers , Michael Paquier , Amit Kapila References: <055bb33c-bccc-bc1d-c2f8-8598534448ac@gmail.com> <20240510155742.sznwmnmllsewjsbc@awork3.anarazel.de> <0a2e14d3-fbc8-9e86-a968-e0c4a465e5b0@gmail.com> From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 11.05.2024 07:25, Thomas Munro wrote: > On Sat, May 11, 2024 at 4:00 PM Alexander Lakhin wrote: >> 11.05.2024 06:26, Thomas Munro wrote: >>> Perhaps a no-image, no-change registered buffer should not be >>> including an image, even for XLR_CHECK_CONSISTENCY? It's actually >>> useless for consistency checking too I guess, this issue aside, >>> because it doesn't change anything so there is nothing to check. >> Yes, I think something wrong is here. I've reduced the reproducer to: > Does it reproduce if you do this? > > - include_image = needs_backup || (info & > XLR_CHECK_CONSISTENCY) != 0; > + include_image = needs_backup || > + ((info & XLR_CHECK_CONSISTENCY) != 0 && > + (regbuf->flags & REGBUF_NO_CHANGE) == 0); No, it doesn't (at least with the latter, more targeted reproducer). > Unfortunately the back branches don't have that new flag from 00d7fb5e > so, even if this is the right direction (not sure, I don't understand > this clean registered buffer trick) then ... but wait, why are there > are no failures like this in the back branches (yet at least)? Does > your reproducer work for 16? I wonder if something relevant changed > recently, like f56a9def. CC'ing Michael and Amit K for info. Maybe it's hard to hit (autovacuum needs to process the index page in a narrow time frame), but locally I could reproduce the issue even on ac27c74de(~1 too) from 2018-09-06 (I tried several last commits touching hash indexes, didn't dig deeper). Best regards, Alexander