Re: [PATCH 03/14] Add simple xlogdump tool

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH 03/14] Add simple xlogdump tool
Date: 2012-12-06 16:13:52
Message-ID: 20121206161352.GB1000@alap2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I tried to address most (all?) your comments in the version from
http://archives.postgresql.org/message-id/20121204175212.GB12055%40awork2.anarazel.de
.

On 2012-11-15 11:31:55 -0500, Peter Eisentraut wrote:
> > +xlogdump: $(OBJS) $(shell find ../../backend ../../timezone -name objfiles.txt|xargs cat|tr -s " " "\012"|grep -v /main.o|sed 's/^/..\/..\/..\//')
> > + $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $(at)$(X)
>
> This looks pretty evil, and there is no documentation about what it is
> supposed to do.
>
> Windows build support needs some thought.

Ok, since Alvaro made it possible the build now only has rules like:

xlogreader.c: % : $(top_srcdir)/src/backend/access/transam/%
rm -f $@ && $(LN_S) $< .

clogdesc.c: % : $(top_srcdir)/src/backend/access/rmgrdesc/%
rm -f $@ && $(LN_S) $< .
and
OBJS = \
clogdesc.o dbasedesc.o gindesc.o gistdesc.o hashdesc.o heapdesc.o \
mxactdesc.o nbtdesc.o relmapdesc.o seqdesc.o smgrdesc.o spgdesc.o \
standbydesc.o tblspcdesc.o xactdesc.o xlogdesc.o assert.o \
$(WIN32RES) \
pg_xlogdump.o pqexpbuf_strinfo.o compat.o tables.o xlogreader.o \

pg_xlogdump: $(OBJS) | submake-libpq submake-libpgport
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) $(libpq_pgport) -o $(at)$(X)

Thats easier easier to integrate into the windows build?

> > +static void
> > +usage(void)
> > +{
> > + printf(_("%s reads/writes postgres transaction logs for debugging.\n\n"),
> > + progname);
> > + printf(_("Usage:\n"));
> > + printf(_(" %s [OPTION]...\n"), progname);
> > + printf(_("\nOptions:\n"));
> > + printf(_(" -v, --version output version information, then exit\n"));
> > + printf(_(" -h, --help show this help, then exit\n"));
> > + printf(_(" -s, --start from where recptr onwards to read\n"));
> > + printf(_(" -e, --end up to which recptr to read\n"));
> > + printf(_(" -t, --timeline which timeline do we want to read\n"));
> > + printf(_(" -i, --inpath from where do we want to read? cwd/pg_xlog is the default\n"));
> > + printf(_(" -o, --output where to write [start, end]\n"));
> > + printf(_(" -f, --file wal file to parse\n"));
> > +}
>
> Options list should be in alphabetic order (or some other less random
> order). Most of these descriptions are not very intelligible (at least
> without additional documentation).

I tried to improve the help, its now:

pg_xlogdump: reads/writes postgres transaction logs for debugging.

Usage:
pg_xlogdump [OPTION]...

Options:
-b, --bkp-details output detailed information about backup blocks
-e, --end RECPTR read wal up to RECPTR
-f, --file FILE wal file to parse, cannot be specified together with -p
-h, --help show this help, then exit
-p, --path PATH from where do we want to read? cwd/pg_xlog is the default
-s, --start RECPTR read wal in directory indicated by -p starting at RECPTR
-t, --timeline TLI which timeline do we want to read, defaults to 1
-v, --version output version information, then exit

I wonder whether it would make sense to split the help into different
sections? It seems likely we will gain some more options...

> no nls.mk

Do I need to do anything for that besides:

# src/bin/pg_xlogdump/nls.mk
CATALOG_NAME = pg_xlogdump
AVAIL_LANGUAGES =
GETTEXT_FILES = pg_xlogdump.c

?

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-12-06 16:43:45 Re: Functional dependency in GROUP BY through JOINs
Previous Message Kevin Grittner 2012-12-06 15:44:36 Re: Enabling Checksums