On 11/03/2026 13:07, Alexander Kuzmenkov wrote:
> On Wed, Mar 11, 2026 at 11:45 AM Alexander Kuzmenkov
> <akuzmenkov@tigerdata.com> wrote:
>>
>> On Tue, Mar 10, 2026 at 11:09 PM Heikki Linnakangas <hlinnaka@iki.fi> wrote:
>>> +1 for initializing all padding in WAL records. In fact I thought that
>>> we already did that. (Except in this case, apparently)
>>
>> I found 42 exceptions like this. See the attached patch, it
>> initializes some WAL records and removes the WAL-related Valgrind
>> suppressions. The regression tests pass under Valgrind with these
>> changes.
>
> I think I'm making some unneeded changes here though. For example in
> ginxlogInsertListPage for a two-int struct with no padding. I'll need
> to check them again one by one.
I experimented with this a little more. Valgrind complained about one
more place on 'master': the xl_multixact_create got padding, when
MultiXactOffset was widened to 64 bits. That could be fixed by swapping
the fields.
Another thing I did to find possible initializations: I ran 'pahole
bin/postgres' and search for all the "xl_*" structs with padding, and
then looked at where they're initialized. Attached patch (0003) shows a
few places that look suspicious to me. I don't think I caught all
structs used in WAL records, though, like the ginxlogInsertListPage
thing mentioned.
I wish we could just mark all WAL record structs with
pg_attribute_packed(). Unfortunately pg_attribute_packed() is not
available on all compilers we support.
- Heikki