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 */
|
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:18:54 +02:00
|
|
|
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 */
|
2017-01-16 13:56:43 +01: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 */
|
|
|
|
|
2017-04-28 00:27:02 +02:00
|
|
|
pgsocket stop_socket; /* if valid, watch for input on this socket
|
|
|
|
* and check stream_stop() when there is any */
|
|
|
|
|
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 */
|
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:18:54 +02:00
|
|
|
char *replication_slot; /* Replication slot to use, or NULL */
|
2016-03-11 11:08:01 +01:00
|
|
|
} 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
|
|
|
|
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
2017-06-21 21:18:54 +02:00
|
|
|
#endif /* RECEIVELOG_H */
|