At Wed, 9 Feb 2022 08:15:45 -0300, Ranier Vilela <ranier.vf@gmail.com> wrote in
> Hi,
>
> Commit
> https://github.com/postgres/postgres/commit/1eb6d6527aae264b3e0b9c95aa70bb7a594ad1cf,
> modified
> data struct TwoPhaseFileHeader and added two new fields:
>
> XLogRecPtr origin_lsn; /* lsn of this record at origin node */
> TimestampTz origin_timestamp; /* time of prepare at origin node */
>
> I think thay forgot initialize these fields in the function StartPrepare
> because,
> when calling function save_state_data(&hdr, sizeof(TwoPhaseFileHeader));
>
> I have one report about possible uninitialized usage of the variables.
Who repoerted that to you?
StartPrepare and EndPrepare are virtually a single function that
accepts some additional operations in the middle. StartPrepare leaves
the "records" incomplete then EndPrepare completes it. It is not
designed so that the fields are accessed from others before the
completion. There seems to be no critical reasons for EndPrepare to
do the pointed operations, but looking that another replorigin-related
operation is needed in the same function, it is sensible that the
author intended to consolidate all replorigin related changes in
EndPrepare.
So, my humble opinion here is, that change is not needed.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center