You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2025-07-17 07:22:20 +02:00
Add support postgres 9.6.
This commit is contained in:
8
Makefile
8
Makefile
@ -21,7 +21,7 @@ OBJS = backup.o \
|
|||||||
pgut/pgut.o \
|
pgut/pgut.o \
|
||||||
pgut/pgut-port.o
|
pgut/pgut-port.o
|
||||||
|
|
||||||
EXTRA_CLEAN = datapagemap.c datapagemap.h xlogreader.c receivelog.h streamutil.h
|
EXTRA_CLEAN = datapagemap.c datapagemap.h xlogreader.c receivelog.h streamutil.h logging.h
|
||||||
|
|
||||||
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS}
|
PG_CPPFLAGS = -I$(libpq_srcdir) ${PTHREAD_CFLAGS}
|
||||||
override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
|
override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
|
||||||
@ -29,7 +29,7 @@ PG_LIBS = $(libpq_pgport) ${PTHREAD_LIBS} ${PTHREAD_CFLAGS}
|
|||||||
|
|
||||||
REGRESS = init option show delete backup restore
|
REGRESS = init option show delete backup restore
|
||||||
|
|
||||||
all: checksrcdir datapagemap.h receivelog.h streamutil.h pg_arman
|
all: checksrcdir datapagemap.h logging.h receivelog.h streamutil.h pg_arman
|
||||||
|
|
||||||
# This rule's only purpose is to give the user instructions on how to pass
|
# This rule's only purpose is to give the user instructions on how to pass
|
||||||
# the path to PostgreSQL source tree to the makefile.
|
# the path to PostgreSQL source tree to the makefile.
|
||||||
@ -49,6 +49,10 @@ datapagemap.c: % : $(top_srcdir)/src/bin/pg_rewind/%
|
|||||||
rm -f $@ && $(LN_S) $< .
|
rm -f $@ && $(LN_S) $< .
|
||||||
datapagemap.h: % : $(top_srcdir)/src/bin/pg_rewind/%
|
datapagemap.h: % : $(top_srcdir)/src/bin/pg_rewind/%
|
||||||
rm -f && $(LN_S) $< .
|
rm -f && $(LN_S) $< .
|
||||||
|
#logging.c: % : $(top_srcdir)/src/bin/pg_rewind/%
|
||||||
|
# rm -f && $(LN_S) $< .
|
||||||
|
logging.h: % : $(top_srcdir)/src/bin/pg_rewind/%
|
||||||
|
rm -f && $(LN_S) $< .
|
||||||
receivelog.c: % : $(top_srcdir)/src/bin/pg_basebackup/%
|
receivelog.c: % : $(top_srcdir)/src/bin/pg_basebackup/%
|
||||||
rm -f && $(LN_S) $< .
|
rm -f && $(LN_S) $< .
|
||||||
receivelog.h: % : $(top_srcdir)/src/bin/pg_basebackup/%
|
receivelog.h: % : $(top_srcdir)/src/bin/pg_basebackup/%
|
||||||
|
14
backup.c
14
backup.c
@ -1326,9 +1326,23 @@ StreamLog(void *arg)
|
|||||||
progname, (uint32) (startpos >> 32), (uint32) startpos,
|
progname, (uint32) (startpos >> 32), (uint32) startpos,
|
||||||
starttli);
|
starttli);
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= 90600
|
||||||
|
StreamCtl ctl;
|
||||||
|
ctl.startpos = startpos;
|
||||||
|
ctl.timeline = starttli;
|
||||||
|
ctl.sysidentifier = NULL;
|
||||||
|
ctl.basedir = basedir;
|
||||||
|
ctl.stream_stop = stop_streaming;
|
||||||
|
ctl.standby_message_timeout = standby_message_timeout;
|
||||||
|
ctl.partial_suffix = ".partial";
|
||||||
|
ctl.synchronous = false;
|
||||||
|
ctl.mark_done = false;
|
||||||
|
ReceiveXlogStream(conn, &ctl);
|
||||||
|
#else
|
||||||
ReceiveXlogStream(conn, startpos, starttli, NULL, basedir,
|
ReceiveXlogStream(conn, startpos, starttli, NULL, basedir,
|
||||||
stop_streaming, standby_message_timeout, ".partial",
|
stop_streaming, standby_message_timeout, ".partial",
|
||||||
false, false);
|
false, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
|
49
pgut/pgut.c
49
pgut/pgut.c
@ -50,6 +50,16 @@ static bool in_cleanup = false;
|
|||||||
|
|
||||||
static bool parse_pair(const char buffer[], char key[], char value[]);
|
static bool parse_pair(const char buffer[], char key[], char value[]);
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PG_DEBUG,
|
||||||
|
PG_PROGRESS,
|
||||||
|
PG_WARNING,
|
||||||
|
PG_FATAL
|
||||||
|
} eLogType;
|
||||||
|
|
||||||
|
void pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2, 3);
|
||||||
|
|
||||||
/* Connection routines */
|
/* Connection routines */
|
||||||
static void init_cancel_handler(void);
|
static void init_cancel_handler(void);
|
||||||
static void on_before_exec(PGconn *conn);
|
static void on_before_exec(PGconn *conn);
|
||||||
@ -1202,6 +1212,45 @@ elog(int elevel, const char *fmt, ...)
|
|||||||
exit_or_abort(elevel);
|
exit_or_abort(elevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pg_log(eLogType type, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
if (!verbose && type <= PG_PROGRESS)
|
||||||
|
return;
|
||||||
|
if (quiet && type < PG_WARNING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case PG_DEBUG:
|
||||||
|
fputs("DEBUG: ", stderr);
|
||||||
|
break;
|
||||||
|
case PG_PROGRESS:
|
||||||
|
fputs("PROGRESS: ", stderr);
|
||||||
|
break;
|
||||||
|
case PG_WARNING:
|
||||||
|
fputs("WARNING: ", stderr);
|
||||||
|
break;
|
||||||
|
case PG_FATAL:
|
||||||
|
fputs("FATAL: ", stderr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (type >= PG_FATAL)
|
||||||
|
fputs("ERROR: ", stderr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start(args, fmt);
|
||||||
|
vfprintf(stderr, fmt, args);
|
||||||
|
fputc('\n', stderr);
|
||||||
|
fflush(stderr);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
if (type > 0)
|
||||||
|
exit_or_abort(type);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
static CRITICAL_SECTION cancelConnLock;
|
static CRITICAL_SECTION cancelConnLock;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user