Re: ThisTimeLineID can be used uninitialized

2021-10-25 Thread Robert Haas
On Thu, Oct 21, 2021 at 3:29 PM Robert Haas wrote: > I think the correct fix for this particular problem is just to delete > the initialization, as in the attached patch. I spent a long time > studying this today and eventually convinced myself that there's just > no way these initializations can

Re: ThisTimeLineID can be used uninitialized

2021-10-21 Thread Robert Haas
On Tue, Oct 19, 2021 at 4:44 PM Andres Freund wrote: > It's quite confusing. It's *really* not helped by physical replication using > but not really using an xlogreader to keep state. Which presumably isn't > actually used during a physical CreateReplicationSlot(), but is referenced by > a comment

Re: ThisTimeLineID can be used uninitialized

2021-10-21 Thread Alvaro Herrera
On 2021-Oct-21, Michael Paquier wrote: > 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

Re: ThisTimeLineID can be used uninitialized

2021-10-20 Thread Michael Paquier
On Wed, Oct 20, 2021 at 09:08:57AM -0400, Robert Haas wrote: > On Tue, Oct 19, 2021 at 7:30 PM Alvaro Herrera > 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

Re: ThisTimeLineID can be used uninitialized

2021-10-20 Thread Alvaro Herrera
On 2021-Oct-20, Robert Haas wrote: > On Tue, Oct 19, 2021 at 7:30 PM Alvaro Herrera > wrote: > > Hah. Yeah, when you can do things like that and the tests don't break, > > that indicates a problem in the tests. > > I *think* the problem is actually in the code, not the tests. In other > words,

Re: ThisTimeLineID can be used uninitialized

2021-10-20 Thread Robert Haas
On Tue, Oct 19, 2021 at 7:30 PM Alvaro Herrera wrote: > Hah. Yeah, when you can do things like that and the tests don't break, > that indicates a problem in the tests. I *think* the problem is actually in the code, not the tests. In other words, from what I can tell, we copy the bogus timeline v

Re: ThisTimeLineID can be used uninitialized

2021-10-19 Thread Alvaro Herrera
On 2021-Oct-19, Andres Freund wrote: > Hi, > > On 2021-10-19 15:13:04 -0400, Robert Haas wrote: > > This is a followup to > > http://postgr.es/m/ca+tgmoz5a26c6oxkapafyuy_sx0vg6vxdd_q6asezsvrphd...@mail.gmail.com. > > I'm suspicious of the following code in CreateReplicationSlot: > > > > /* s

Re: ThisTimeLineID can be used uninitialized

2021-10-19 Thread Andres Freund
Hi, On 2021-10-19 15:13:04 -0400, Robert Haas wrote: > This is a followup to > http://postgr.es/m/ca+tgmoz5a26c6oxkapafyuy_sx0vg6vxdd_q6asezsvrphd...@mail.gmail.com. > I'm suspicious of the following code in CreateReplicationSlot: > > /* setup state for WalSndSegmentOpen */ > sendTimeLine

ThisTimeLineID can be used uninitialized

2021-10-19 Thread Robert Haas
Hi, This is a followup to http://postgr.es/m/ca+tgmoz5a26c6oxkapafyuy_sx0vg6vxdd_q6asezsvrphd...@mail.gmail.com. I'm suspicious of the following code in CreateReplicationSlot: /* setup state for WalSndSegmentOpen */ sendTimeLineIsHistoric = false; sendTimeLine = ThisTimeLineID; The f