Skip to content

Commit 60dec44

Browse files
committed
Fixes pg_xlogdump to work with Postgres-XC xlog, to handle BARRIER
log record correctly. Submitted by Wang Diancheng.
1 parent 1ff0c1c commit 60dec44

File tree

6 files changed

+42
-15
lines changed

6 files changed

+42
-15
lines changed

contrib/pg_xlogdump/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
/xactdesc.c
1818
/xlogdesc.c
1919
/xlogreader.c
20+
/pgxcdesc.c

contrib/pg_xlogdump/compat.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ timestamptz_to_time_t(TimestampTz t)
3939
return result;
4040
}
4141

42+
#ifdef PGXC
43+
/*
44+
* used in common/relpath.c
45+
*/
46+
char *PGXCNodeName = NULL;
47+
#endif
4248
/*
4349
* Stopgap implementation of timestamptz_to_str that doesn't depend on backend
4450
* infrastructure. This will work for timestamps that are within the range

contrib/pg_xlogdump/rmgrdesc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "rmgrdesc.h"
2727
#include "storage/standby.h"
2828
#include "utils/relmapper.h"
29+
#ifdef PGXC
30+
#include "pgxc/barrier.h"
31+
#endif
2932

3033
#define PG_RMGR(symname,name,redo,desc,startup,cleanup,restartpoint) \
3134
{ name, desc, },

src/backend/access/rmgrdesc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ include $(top_builddir)/src/Makefile.global
1010

1111
OBJS = clogdesc.o dbasedesc.o gindesc.o gistdesc.o hashdesc.o heapdesc.o \
1212
mxactdesc.o nbtdesc.o relmapdesc.o seqdesc.o smgrdesc.o spgdesc.o \
13-
standbydesc.o tblspcdesc.o xactdesc.o xlogdesc.o
13+
standbydesc.o tblspcdesc.o xactdesc.o xlogdesc.o pgxcdesc.o
1414

1515
include $(top_srcdir)/src/backend/common.mk
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* pgxcdesc.c
4+
* rmgr descriptor routines for XC special
5+
*
6+
*
7+
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
8+
* Portions Copyright (c) 2010-2014 Postgres-XC Development Group
9+
*
10+
* IDENTIFICATION
11+
* $$
12+
*
13+
*-------------------------------------------------------------------------
14+
*/
15+
16+
#include "postgres.h"
17+
18+
#include "pgxc/barrier.h"
19+
void
20+
barrier_redo(XLogRecPtr lsn, XLogRecord *record)
21+
{
22+
/* Nothing to do */
23+
return;
24+
}
25+
26+
void
27+
barrier_desc(StringInfo buf, uint8 xl_info, char *rec)
28+
{
29+
Assert(xl_info == XLOG_BARRIER_CREATE);
30+
appendStringInfo(buf, "BARRIER %s", rec);
31+
}

src/backend/pgxc/barrier/barrier.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -492,17 +492,3 @@ RequestBarrier(const char *id, char *completionTag)
492492
if (completionTag)
493493
snprintf(completionTag, COMPLETION_TAG_BUFSIZE, "BARRIER %s", barrier_id);
494494
}
495-
496-
void
497-
barrier_redo(XLogRecPtr lsn, XLogRecord *record)
498-
{
499-
/* Nothing to do */
500-
return;
501-
}
502-
503-
void
504-
barrier_desc(StringInfo buf, uint8 xl_info, char *rec)
505-
{
506-
Assert(xl_info == XLOG_BARRIER_CREATE);
507-
appendStringInfo(buf, "BARRIER %s", rec);
508-
}

0 commit comments

Comments
 (0)