Skip to content

Conversation

@pedercandersen
Copy link

I'm interested in parsing WAL files and processing the results programatically. Your work on the xlogdump tool provides a great platform, and this pull request factors out some of the prime logic into a stand-alone library so arbitrary clients can customize their handling on a record-by-record basis.

Please let me know if there's any changes you'd like to see before merging, or if any other information would be useful.

thanks,

  • peder

MacOS provides strlcpy(), no need for a private version.  At some point
this should be replaced with a more general test for the routine, rather
than having to manually specify this based on the reported OS.
Ignore files generated by the build, as well as emacs droppings
which may be generated in the course of editing.
The xlogdump package has a number of routines which come in handy
when you need to parse a postgres WAL journal.  This commit takes
the first step in splitting useful logic out into an xlogparse
library, for use by arbitrary clients, by factoring out the
ReadRecord() routine.  The new routine returns its state rather
than just a pass/fail, allowing clients to customize their
response to conditions like end-of-log, and log file switch.

As part of this refactoring, took the opportunity to cull unused
header inclusions from affected files.
Factored the value demarshalling logic out of printValue()
and added it to the xlogparse library as DecodeValue().

Culled unused header inclusions from xlogdump_statement.c
As a library, our parsing code shouldn't assume that clients want
stdout descriptions of each page as it's read.  To fix this and
support the traditional xlogdump model, this behavior can now be
optionally enabled using the SetPageInfoDump() routine.  In the
future, it may make sense to take this a step further and give
clients a finer grained control, like the ability to specify
the output stream for both standard and error output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant