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

Andres Freund <andres@2ndquadrant.com>

From: Andres Freund <andres@2ndquadrant.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-hackers@postgresql.org
Date: 2012-12-06T16:13:52Z
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 $@$(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 $@$(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


Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Background worker processes

  2. Rearrange storage of data in xl_running_xacts.

  3. Basic binary heap implementation.

  4. Embedded list interface

  5. Refactor xlog.c to create src/backend/postmaster/startup.c