On 2014-03-05 17:05:24 -0500, Robert Haas wrote:
> > I very much dislike having the three different event loops, but it's
> > pretty much forced by the design of the xlogreader. "My" xlogreader
> > version didn't block when it neeeded to wait for WAL but just returned
> > "need input/output", but with the eventually committed version you're
> > pretty much forced to block inside the read_page callback.
> >
> > I don't really have a idea how we could sensibly unify them atm.
>
> WalSndLoop(void (*gutsfn)())?
The problem is that they are actually different. In the WalSndLoop we're
also maintaining the walsender's state, in WalSndWriteData() we're just
waiting for writes to be flushed, in WalSndWaitForWal we're primarily
waiting for the flush pointer to pass some LSN. And the timing of the
individual checks isn't trivial (just added some more comments about
it).
I'll simplify it by pulling out more common code, maybe it'll become
apparent how it should look.
Greetings,
Andres Freund
PS: I so far considered my language counted poetic, that's why I used
the splicing comma so liberally... Thanks for the link.
-- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services