Re: [PATCH 03/14] Add simple xlogdump tool - Mailing list pgsql-hackers

From Andres Freund
Subject Re: [PATCH 03/14] Add simple xlogdump tool
Date
Msg-id 20121206161352.GB1000@alap2
Whole thread Raw
In response to Re: [PATCH 03/14] Add simple xlogdump tool  (Peter Eisentraut <peter_e@gmx.net>)
List 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 $@$(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.osmgrdesc.o spgdesc.o \    standbydesc.o tblspcdesc.o xactdesc.o xlogdesc.o assert.o \    $(WIN32RES) \
pg_xlogdump.opqexpbuf_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 $@$(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
readwal in directory indicated by -p starting at RECPTR -t, --timeline TLI     which timeline do we want to read,
defaultsto 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



pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Enabling Checksums
Next
From: Simon Riggs
Date:
Subject: Re: Functional dependency in GROUP BY through JOINs