Re: Changeset Extraction v7.9.1
От | Andres Freund |
---|---|
Тема | Re: Changeset Extraction v7.9.1 |
Дата | |
Msg-id | 20140307124437.GA22909@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Re: Changeset Extraction v7.9.1 (Andres Freund <andres@2ndquadrant.com>) |
Ответы |
Re: Changeset Extraction v7.9.1
Re: Changeset Extraction v7.9.1 |
Список | pgsql-hackers |
Hi, On 2014-03-05 23:20:57 +0100, Andres Freund wrote: > 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. I've attached a new version of the walsender patch. It's been rebased ontop of Heikki's latest commit to walsender.c. I've changed a fair bit of stuff: * The sleeptime is now computed to sleep until we either need to send a keepalive or kill ourselves, as Heikki sugggested. * Sleep time computation, sending pings, checking timeouts is now done in separate functions. * Comment and codestyle improvements. Although they are shorter and simpler now, I have not managed to unify the three loops however. They seem to be too different to unify them inside one. I tried a common function with an 'wait_for' bitmask argument, but that turned out to be fairly illegible. The checks in WalSndWaitForWal() and WalSndLoop() just seem to be too different. I'd be grateful if you (or somebody else!) could have a quick look at body of the loops in WalSndWriteData(), WalSndWaitForWal() and WalSndLoop(). Maybe I am just staring at it the wrong way. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: