Re: [PATCH 3/8] Add support for a generic wal reading facility dubbed XLogReader
Andres Freund <andres@2ndquadrant.com>
From: Andres Freund <andres@2ndquadrant.com>
To: pgsql-hackers@postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>,
Heikki Linnakangas <hlinnakangas@vmware.com>, Robert Haas <robertmhaas@gmail.com>, Kevin Grittner <Kevin.Grittner@wicourts.gov>, Alvaro Herrera <alvherre@2ndquadrant.com>, Simon Riggs <simon@2ndquadrant.com>
Date: 2012-09-17T14:29:57Z
Lists: pgsql-hackers
On Monday, September 17, 2012 04:08:01 PM Tom Lane wrote: > Heikki Linnakangas <hlinnakangas@vmware.com> writes: > > On 17.09.2012 13:01, Andres Freund wrote: > >> It seems we would need one additional callback for both approaches like: > >> ->error(severity, format, ...) > >> For both to avoid having to draw in elog.c. > > > > Yeah. Another approach would be to return the error string from > > ReadRecord. The caller could then do whatever it pleases with it, like > > ereport() it to the log or PANIC. I think I'd like that better. > > I think it's basically insane to imagine that you can carve out a > non-trivial piece of the backend that doesn't contain any elog calls. > There's too much low-level infrastructure, such as palloc, that could > call it. Even if you managed to make it safe at the instant the feature > is committed, the odds it would stay safe over time are negligible. If you start relying on palloc all hope is gone anyway. I "only" want a standalone XLogReader because thats just too damn annoying/hard to duplicate in standalone code. There are several very useful utilities out there that are incomplete and/or unreliable for that reason. And loads of others that haven't been written because of that. That is one of the reasons - beside finding the respective xlog.c code very hard to read/modify/extend - why I wrote a completely standalone xlogreader. One other factor was just learning how the hell all that works ;) I still think the interface that something plain as the proposed XLogReadRecord() provides is too restrictive for many use-cases. I aggree that a wrapper with exactly such an interface for xlog.c is useful, though. > Furthermore, returning enough state for useful error messages back out > of multiple layers of function call is going to be notationally messy, > and will end up requiring complicated infrastructure barely simpler than > elog anyway. Hm. You mean because of file/function/location? > It'd be a lot better for the wal-dumping program to supply a cut-down > version of elog than to try to promise that all errors will be returned > back from ReadRecord. Well, I suggested a ->error() callback for that reason, that seems relatively easy to wrap. Greetings, Andres -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Move "hot" members of PGPROC into a separate PGXACT array.
- ed0b409d2234 9.2.0 cited