mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
pgindent run for 9.0, second run
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c,v 1.11 2010/06/11 10:13:09 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c,v 1.12 2010/07/06 19:18:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -86,9 +86,9 @@ libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
|
||||
char cmd[64];
|
||||
|
||||
/*
|
||||
* Connect using deliberately undocumented parameter: replication.
|
||||
* The database name is ignored by the server in replication mode, but
|
||||
* specify "replication" for .pgpass lookup.
|
||||
* Connect using deliberately undocumented parameter: replication. The
|
||||
* database name is ignored by the server in replication mode, but specify
|
||||
* "replication" for .pgpass lookup.
|
||||
*/
|
||||
snprintf(conninfo_repl, sizeof(conninfo_repl),
|
||||
"%s dbname=replication replication=true",
|
||||
@@ -168,7 +168,7 @@ libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
|
||||
|
||||
justconnected = true;
|
||||
ereport(LOG,
|
||||
(errmsg("streaming replication successfully connected to primary")));
|
||||
(errmsg("streaming replication successfully connected to primary")));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -209,7 +209,7 @@ libpq_select(int timeout_ms)
|
||||
struct timeval *ptr_timeout;
|
||||
|
||||
FD_ZERO(&input_mask);
|
||||
FD_SET (PQsocket(streamConn), &input_mask);
|
||||
FD_SET(PQsocket(streamConn), &input_mask);
|
||||
|
||||
if (timeout_ms < 0)
|
||||
ptr_timeout = NULL;
|
||||
@@ -253,19 +253,18 @@ libpq_select(int timeout_ms)
|
||||
static PGresult *
|
||||
libpqrcv_PQexec(const char *query)
|
||||
{
|
||||
PGresult *result = NULL;
|
||||
PGresult *lastResult = NULL;
|
||||
PGresult *result = NULL;
|
||||
PGresult *lastResult = NULL;
|
||||
|
||||
/*
|
||||
* PQexec() silently discards any prior query results on the
|
||||
* connection. This is not required for walreceiver since it's
|
||||
* expected that walsender won't generate any such junk results.
|
||||
* PQexec() silently discards any prior query results on the connection.
|
||||
* This is not required for walreceiver since it's expected that walsender
|
||||
* won't generate any such junk results.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Submit a query. Since we don't use non-blocking mode, this also
|
||||
* can block. But its risk is relatively small, so we ignore that
|
||||
* for now.
|
||||
* Submit a query. Since we don't use non-blocking mode, this also can
|
||||
* block. But its risk is relatively small, so we ignore that for now.
|
||||
*/
|
||||
if (!PQsendQuery(streamConn, query))
|
||||
return NULL;
|
||||
@@ -273,16 +272,16 @@ libpqrcv_PQexec(const char *query)
|
||||
for (;;)
|
||||
{
|
||||
/*
|
||||
* Receive data until PQgetResult is ready to get the result
|
||||
* without blocking.
|
||||
* Receive data until PQgetResult is ready to get the result without
|
||||
* blocking.
|
||||
*/
|
||||
while (PQisBusy(streamConn))
|
||||
{
|
||||
/*
|
||||
* We don't need to break down the sleep into smaller increments,
|
||||
* and check for interrupts after each nap, since we can just
|
||||
* elog(FATAL) within SIGTERM signal handler if the signal
|
||||
* arrives in the middle of establishment of replication connection.
|
||||
* elog(FATAL) within SIGTERM signal handler if the signal arrives
|
||||
* in the middle of establishment of replication connection.
|
||||
*/
|
||||
if (!libpq_select(-1))
|
||||
continue; /* interrupted */
|
||||
@@ -291,10 +290,9 @@ libpqrcv_PQexec(const char *query)
|
||||
}
|
||||
|
||||
/*
|
||||
* Emulate the PQexec()'s behavior of returning the last result
|
||||
* when there are many.
|
||||
* Since walsender will never generate multiple results, we skip
|
||||
* the concatenation of error messages.
|
||||
* Emulate the PQexec()'s behavior of returning the last result when
|
||||
* there are many. Since walsender will never generate multiple
|
||||
* results, we skip the concatenation of error messages.
|
||||
*/
|
||||
result = PQgetResult(streamConn);
|
||||
if (result == NULL)
|
||||
|
@@ -29,7 +29,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/replication/walreceiver.c,v 1.15 2010/07/03 20:43:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/replication/walreceiver.c,v 1.16 2010/07/06 19:18:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -159,6 +159,7 @@ WalReceiverMain(void)
|
||||
{
|
||||
char conninfo[MAXCONNINFO];
|
||||
XLogRecPtr startpoint;
|
||||
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile WalRcvData *walrcv = WalRcv;
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/replication/walreceiverfuncs.c,v 1.6 2010/07/03 20:43:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/replication/walreceiverfuncs.c,v 1.7 2010/07/06 19:18:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -211,7 +211,7 @@ RequestXLogStreaming(XLogRecPtr recptr, const char *conninfo)
|
||||
* Returns the last+1 byte position that walreceiver has written.
|
||||
*
|
||||
* Optionally, returns the previous chunk start, that is the first byte
|
||||
* written in the most recent walreceiver flush cycle. Callers not
|
||||
* written in the most recent walreceiver flush cycle. Callers not
|
||||
* interested in that value may pass NULL for latestChunkStart.
|
||||
*/
|
||||
XLogRecPtr
|
||||
|
@@ -28,7 +28,7 @@
|
||||
* Portions Copyright (c) 2010-2010, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.27 2010/06/17 16:41:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.28 2010/07/06 19:18:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -66,7 +66,8 @@ bool am_walsender = false; /* Am I a walsender process ? */
|
||||
int max_wal_senders = 0; /* the maximum number of concurrent walsenders */
|
||||
int WalSndDelay = 200; /* max sleep time between some actions */
|
||||
|
||||
#define NAPTIME_PER_CYCLE 100000L /* max sleep time between cycles (100ms) */
|
||||
#define NAPTIME_PER_CYCLE 100000L /* max sleep time between cycles
|
||||
* (100ms) */
|
||||
|
||||
/*
|
||||
* These variables are used similarly to openLogFile/Id/Seg/Off,
|
||||
@@ -266,10 +267,10 @@ WalSndHandshake(void)
|
||||
* NOTE: This only checks the current value of
|
||||
* wal_level. Even if the current setting is not
|
||||
* 'minimal', there can be old WAL in the pg_xlog
|
||||
* directory that was created with 'minimal'.
|
||||
* So this is not bulletproof, the purpose is
|
||||
* just to give a user-friendly error message that
|
||||
* hints how to configure the system correctly.
|
||||
* directory that was created with 'minimal'. So this
|
||||
* is not bulletproof, the purpose is just to give a
|
||||
* user-friendly error message that hints how to
|
||||
* configure the system correctly.
|
||||
*/
|
||||
if (wal_level == WAL_LEVEL_MINIMAL)
|
||||
ereport(FATAL,
|
||||
@@ -378,7 +379,7 @@ WalSndLoop(void)
|
||||
/* Loop forever, unless we get an error */
|
||||
for (;;)
|
||||
{
|
||||
long remain; /* remaining time (us) */
|
||||
long remain; /* remaining time (us) */
|
||||
|
||||
/*
|
||||
* Emergency bailout if postmaster has died. This is to avoid the
|
||||
@@ -422,8 +423,8 @@ WalSndLoop(void)
|
||||
*
|
||||
* On some platforms, signals won't interrupt the sleep. To ensure we
|
||||
* respond reasonably promptly when someone signals us, break down the
|
||||
* sleep into NAPTIME_PER_CYCLE increments, and check for
|
||||
* interrupts after each nap.
|
||||
* sleep into NAPTIME_PER_CYCLE increments, and check for interrupts
|
||||
* after each nap.
|
||||
*/
|
||||
if (caughtup)
|
||||
{
|
||||
@@ -503,8 +504,8 @@ InitWalSnd(void)
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_TOO_MANY_CONNECTIONS),
|
||||
errmsg("number of requested standby connections "
|
||||
"exceeds max_wal_senders (currently %d)",
|
||||
max_wal_senders)));
|
||||
"exceeds max_wal_senders (currently %d)",
|
||||
max_wal_senders)));
|
||||
|
||||
/* Arrange to clean up at walsender exit */
|
||||
on_shmem_exit(WalSndKill, 0);
|
||||
@@ -563,13 +564,14 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
|
||||
if (sendFile < 0)
|
||||
{
|
||||
/*
|
||||
* If the file is not found, assume it's because the
|
||||
* standby asked for a too old WAL segment that has already
|
||||
* been removed or recycled.
|
||||
* If the file is not found, assume it's because the standby
|
||||
* asked for a too old WAL segment that has already been
|
||||
* removed or recycled.
|
||||
*/
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
char filename[MAXFNAMELEN];
|
||||
char filename[MAXFNAMELEN];
|
||||
|
||||
XLogFileName(filename, ThisTimeLineID, sendId, sendSeg);
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
@@ -619,10 +621,10 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
|
||||
}
|
||||
|
||||
/*
|
||||
* After reading into the buffer, check that what we read was valid.
|
||||
* We do this after reading, because even though the segment was present
|
||||
* when we opened it, it might get recycled or removed while we read it.
|
||||
* The read() succeeds in that case, but the data we tried to read might
|
||||
* After reading into the buffer, check that what we read was valid. We do
|
||||
* this after reading, because even though the segment was present when we
|
||||
* opened it, it might get recycled or removed while we read it. The
|
||||
* read() succeeds in that case, but the data we tried to read might
|
||||
* already have been overwritten with new WAL records.
|
||||
*/
|
||||
XLogGetLastRemoved(&lastRemovedLog, &lastRemovedSeg);
|
||||
@@ -630,7 +632,8 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
|
||||
if (log < lastRemovedLog ||
|
||||
(log == lastRemovedLog && seg <= lastRemovedSeg))
|
||||
{
|
||||
char filename[MAXFNAMELEN];
|
||||
char filename[MAXFNAMELEN];
|
||||
|
||||
XLogFileName(filename, ThisTimeLineID, log, seg);
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
@@ -662,8 +665,8 @@ XLogSend(char *msgbuf, bool *caughtup)
|
||||
WalDataMessageHeader msghdr;
|
||||
|
||||
/*
|
||||
* Attempt to send all data that's already been written out and fsync'd
|
||||
* to disk. We cannot go further than what's been written out given the
|
||||
* Attempt to send all data that's already been written out and fsync'd to
|
||||
* disk. We cannot go further than what's been written out given the
|
||||
* current implementation of XLogRead(). And in any case it's unsafe to
|
||||
* send WAL that is not securely down to disk on the master: if the master
|
||||
* subsequently crashes and restarts, slaves must not have applied any WAL
|
||||
@@ -683,19 +686,18 @@ XLogSend(char *msgbuf, bool *caughtup)
|
||||
* MAX_SEND_SIZE bytes to send, send everything. Otherwise send
|
||||
* MAX_SEND_SIZE bytes, but round back to logfile or page boundary.
|
||||
*
|
||||
* The rounding is not only for performance reasons. Walreceiver
|
||||
* relies on the fact that we never split a WAL record across two
|
||||
* messages. Since a long WAL record is split at page boundary into
|
||||
* continuation records, page boundary is always a safe cut-off point.
|
||||
* We also assume that SendRqstPtr never points to the middle of a WAL
|
||||
* record.
|
||||
* The rounding is not only for performance reasons. Walreceiver relies on
|
||||
* the fact that we never split a WAL record across two messages. Since a
|
||||
* long WAL record is split at page boundary into continuation records,
|
||||
* page boundary is always a safe cut-off point. We also assume that
|
||||
* SendRqstPtr never points to the middle of a WAL record.
|
||||
*/
|
||||
startptr = sentPtr;
|
||||
if (startptr.xrecoff >= XLogFileSize)
|
||||
{
|
||||
/*
|
||||
* crossing a logid boundary, skip the non-existent last log
|
||||
* segment in previous logical log file.
|
||||
* crossing a logid boundary, skip the non-existent last log segment
|
||||
* in previous logical log file.
|
||||
*/
|
||||
startptr.xlogid += 1;
|
||||
startptr.xrecoff = 0;
|
||||
@@ -739,8 +741,8 @@ XLogSend(char *msgbuf, bool *caughtup)
|
||||
XLogRead(msgbuf + 1 + sizeof(WalDataMessageHeader), startptr, nbytes);
|
||||
|
||||
/*
|
||||
* We fill the message header last so that the send timestamp is taken
|
||||
* as late as possible.
|
||||
* We fill the message header last so that the send timestamp is taken as
|
||||
* late as possible.
|
||||
*/
|
||||
msghdr.dataStart = startptr;
|
||||
msghdr.walEnd = SendRqstPtr;
|
||||
@@ -931,4 +933,5 @@ GetOldestWALSendPointer(void)
|
||||
}
|
||||
return oldest;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user