Re: ThisTimeLineID can be used uninitialized - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: ThisTimeLineID can be used uninitialized
Date
Msg-id YXD9fDgWjRgIQVbw@paquier.xyz
Whole thread Raw
In response to Re: ThisTimeLineID can be used uninitialized  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: ThisTimeLineID can be used uninitialized
List pgsql-hackers
On Wed, Oct 20, 2021 at 09:08:57AM -0400, Robert Haas wrote:
> On Tue, Oct 19, 2021 at 7:30 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>>> Istm we should introduce an InvalidTimeLineID, and explicitly initialize
>>> sendTimeLine to that, and assert that it's valid / invalid in a bunch of
>>> places?
>>
>> That's not a bad idea; it'll help discover bogus code.  Obviously, some
>> additional tests wouldn't harm -- we have a lot more coverage now than
>> in embarrasingly recent past, but it can still be improved.
>
> +1.

There is already an assumption in walsender.c where an invalid
timeline is 0, by the way?  See sendTimeLineNextTLI and sendTimeLine.
Asserting here and there looks like a good thing to do for code paths
where the timeline should, or should not, be set.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_receivewal starting position
Next
From: Masahiko Sawada
Date:
Subject: Re: [Bug] Logical Replication failing if the DateStyle is different in Publisher & Subscriber