agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Antonin Houska <ah@cybertec.at>
To: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: Noah Misch <noah@leadboat.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: vignesh C <vignesh21@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Robert Treat <rob@xzilla.net>
Subject: Re: Adding REPACK [concurrently]
Date: Tue, 07 Apr 2026 11:29:17 +0200
Message-ID: <192673.1775554157@localhost> (raw)
In-Reply-To: <188275.1775552266@localhost>
References: <CALDaNm3tiKhtegx5Cawi34UjbHmNGEDNAtScGM1RgWRtV-5_0Q@mail.gmail.com>
<202604060918.qw5ms7cbr2hz@alvherre.pgsql>
<pbqm52nsviwojptiszg2g6pqntbhnhaotbxshiysnensshnuv5@v6pmney4jror>
<20260407011056.50.noahmisch@microsoft.com>
<jaxapcek2yxbpyegajeim4aczdkjo4od7xxmtauf4fqtjtcpph@ws4anpqvjero>
<1976915.1775537087@sss.pgh.pa.us>
<CAFC+b6ojcdgpVb0euBvqy-b3W7F=NXZ7PhrruQnyzkDouoGZXQ@mail.gmail.com>
<188275.1775552266@localhost>
Antonin Houska <ah@cybertec.at> wrote:
> Srinath Reddy Sadipiralla <srinath2133@gmail.com> wrote:
>
> > i looked into this , it seems like valgrind catches the uninitialised padding bytes, which
> > repack worker is writing using BufFileWrite, it seems this fix solved the problem.
> >
> > diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
> > index 2e6197f5f35..f5682b87626 100644
> > --- a/src/backend/utils/time/snapmgr.c
> > +++ b/src/backend/utils/time/snapmgr.c
> > @@ -1739,6 +1739,8 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
> >
> > Assert(snapshot->subxcnt >= 0);
> >
> > + MemSet(&serialized_snapshot, 0, sizeof(SerializedSnapshotData));
> > +
> > /* Copy all required fields */
> > serialized_snapshot.xmin = snapshot->xmin;
> > serialized_snapshot.xmax = snapshot->xmax;
> >
> > thoughts?
>
> Could you reproduce the failure in your environment?
>
> I haven't thought of this explanation because BufFileWrite() only copies the
> data to a buffer in the BufFile structure and BufFileDumpBuffer() writes the
> buffer. Maybe valgrind is able to track the copying?
Given this message, you may be right:
==1617044== Address 0x12d745e2 is 106 bytes inside a block of size 8,272 client-defined
In my environment, the 'buffer' field starts at offset 80 into the BufFile
structure. We first write 8 bytes into it
BufFileWrite(file, &snap_size, sizeof(snap_size));
followed by the snapshot. Since sizeof(SerializedSnapshotData) is 24, the
offset 106 should be the padding following the 'takenDuringRecovery' field.
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
view thread (416+ messages) latest in thread
Message-ID: <192673.1775554157@localhost>
Permalink: ../192673.1775554157@localhost/
Also on: postgresql.org/message-id/192673.1775554157@localhost
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: ah@cybertec.at, srinath2133@gmail.com, tgl@sss.pgh.pa.us, andres@anarazel.de, noah@leadboat.com, alvherre@alvh.no-ip.org, vignesh21@gmail.com, amit.kapila16@gmail.com, mihailnikalayeu@gmail.com, boekewurm+postgres@gmail.com, pgsql-hackers@lists.postgresql.org, rob@xzilla.net
Subject: Re: Adding REPACK [concurrently]
In-Reply-To: <192673.1775554157@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox