Re: ThisTimeLineID can be used uninitialized
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, Andres Freund <andres@anarazel.de>, amul sul <sulamul@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-10-21T05:41:16Z
Lists: 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
Commits
-
Remove useless code from CreateReplicationSlot.
- 902a2c280012 15.0 landed