2014-08-27 12:31:48 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* receivelog.h
|
|
|
|
*
|
2017-01-03 19:48:53 +01:00
|
|
|
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
|
2014-08-27 12:31:48 +02:00
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
|
|
|
* src/bin/pg_basebackup/receivelog.h
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RECEIVELOG_H
|
|
|
|
#define RECEIVELOG_H
|
|
|
|
|
2014-03-18 17:19:57 +01:00
|
|
|
#include "libpq-fe.h"
|
2016-10-23 15:16:31 +02:00
|
|
|
#include "walmethods.h"
|
2014-03-18 17:19:57 +01:00
|
|
|
|
2011-10-26 20:13:33 +02:00
|
|
|
#include "access/xlogdefs.h"
|
|
|
|
|
|
|
|
/*
|
2012-05-25 11:36:22 +02:00
|
|
|
* Called before trying to read more data or when a segment is
|
|
|
|
* finished. Return true to stop streaming.
|
2011-10-26 20:13:33 +02:00
|
|
|
*/
|
2012-06-10 21:20:04 +02:00
|
|
|
typedef bool (*stream_stop_callback) (XLogRecPtr segendpos, uint32 timeline, bool segment_finished);
|
2011-10-26 20:13:33 +02:00
|
|
|
|
2016-03-11 11:08:01 +01:00
|
|
|
/*
|
|
|
|
* Global parameters when receiving xlog stream. For details about the individual fields,
|
|
|
|
* see the function comment for ReceiveXlogStream().
|
|
|
|
*/
|
|
|
|
typedef struct StreamCtl
|
|
|
|
{
|
|
|
|
XLogRecPtr startpos; /* Start position for streaming */
|
|
|
|
TimeLineID timeline; /* Timeline to stream data from */
|
|
|
|
char *sysidentifier; /* Validate this system identifier and
|
|
|
|
* timeline */
|
|
|
|
int standby_message_timeout; /* Send status messages this
|
|
|
|
* often */
|
2016-09-29 18:00:00 +02:00
|
|
|
bool synchronous; /* Flush immediately WAL data on write */
|
2016-03-11 11:08:01 +01:00
|
|
|
bool mark_done; /* Mark segment as done in generated archive */
|
2016-09-29 18:00:00 +02:00
|
|
|
bool do_sync; /* Flush to disk to ensure consistent state
|
|
|
|
* of data */
|
2016-03-11 11:08:01 +01:00
|
|
|
|
|
|
|
stream_stop_callback stream_stop; /* Stop streaming when returns true */
|
|
|
|
|
2016-10-23 15:16:31 +02:00
|
|
|
WalWriteMethod *walmethod; /* How to write the WAL */
|
2016-03-11 11:08:01 +01:00
|
|
|
char *partial_suffix; /* Suffix appended to partially received files */
|
|
|
|
} StreamCtl;
|
|
|
|
|
|
|
|
|
|
|
|
|
Make pg_basebackup work with pre-9.3 servers, and add server version check.
A new 'starttli' field was added to the response of BASE_BACKUP command.
Make pg_basebackup tolerate the case that it's missing, so that it still
works with older servers.
Add an explicit check for the server version, so that you get a nicer error
message if you try to use it with a pre-9.1 server.
The streaming protocol message format changed in 9.3, so -X stream still won't
work with pre-9.3 servers. I added a version check to ReceiveXLogStream()
earlier, but write that slightly differently, so that in 9.4, it will still
work with a 9.3 server. (In 9.4, the error message needs to be adjusted to
"9.3 or above", though). Also, if the version check fails, don't retry.
2013-03-22 12:02:59 +01:00
|
|
|
extern bool CheckServerVersionForStreaming(PGconn *conn);
|
2011-10-26 20:13:33 +02:00
|
|
|
extern bool ReceiveXlogStream(PGconn *conn,
|
2016-03-11 11:08:01 +01:00
|
|
|
StreamCtl *stream);
|
2014-08-27 12:31:48 +02:00
|
|
|
|
2015-05-24 03:35:49 +02:00
|
|
|
#endif /* RECEIVELOG_H */
|