mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Run pgindent on 9.2 source tree in preparation for first 9.3
commit-fest.
This commit is contained in:
@@ -141,6 +141,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
||||
ti->size = opt->progress ? sendDir(linkpath, strlen(linkpath), true) : -1;
|
||||
tablespaces = lappend(tablespaces, ti);
|
||||
#else
|
||||
|
||||
/*
|
||||
* If the platform does not have symbolic links, it should not be
|
||||
* possible to have tablespaces - clearly somebody else created
|
||||
@@ -148,7 +149,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
||||
*/
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("tablespaces are not supported on this platform")));
|
||||
errmsg("tablespaces are not supported on this platform")));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -661,9 +662,9 @@ sendDir(char *path, int basepathlen, bool sizeonly)
|
||||
/* Allow symbolic links in pg_tblspc only */
|
||||
if (strcmp(path, "./pg_tblspc") == 0 &&
|
||||
#ifndef WIN32
|
||||
S_ISLNK(statbuf.st_mode)
|
||||
S_ISLNK(statbuf.st_mode)
|
||||
#else
|
||||
pgwin32_is_junction(pathbuf)
|
||||
pgwin32_is_junction(pathbuf)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -687,6 +688,7 @@ sendDir(char *path, int basepathlen, bool sizeonly)
|
||||
_tarWriteHeader(pathbuf + basepathlen + 1, linkpath, &statbuf);
|
||||
size += 512; /* Size of the header just added */
|
||||
#else
|
||||
|
||||
/*
|
||||
* If the platform does not have symbolic links, it should not be
|
||||
* possible to have tablespaces - clearly somebody else created
|
||||
@@ -694,9 +696,9 @@ sendDir(char *path, int basepathlen, bool sizeonly)
|
||||
*/
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("tablespaces are not supported on this platform")));
|
||||
errmsg("tablespaces are not supported on this platform")));
|
||||
continue;
|
||||
#endif /* HAVE_READLINK */
|
||||
#endif /* HAVE_READLINK */
|
||||
}
|
||||
else if (S_ISDIR(statbuf.st_mode))
|
||||
{
|
||||
|
@@ -172,10 +172,10 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
|
||||
* never update it again, so we can't be seeing a stale value in that
|
||||
* case.
|
||||
*
|
||||
* Note: on machines with weak memory ordering, the acquisition of
|
||||
* the lock is essential to avoid race conditions: we cannot be sure
|
||||
* the sender's state update has reached main memory until we acquire
|
||||
* the lock. We could get rid of this dance if SetLatch/ResetLatch
|
||||
* Note: on machines with weak memory ordering, the acquisition of the
|
||||
* lock is essential to avoid race conditions: we cannot be sure the
|
||||
* sender's state update has reached main memory until we acquire the
|
||||
* lock. We could get rid of this dance if SetLatch/ResetLatch
|
||||
* contained memory barriers.
|
||||
*/
|
||||
syncRepState = MyProc->syncRepState;
|
||||
@@ -241,8 +241,8 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait on latch. Any condition that should wake us up will set
|
||||
* the latch, so no need for timeout.
|
||||
* Wait on latch. Any condition that should wake us up will set the
|
||||
* latch, so no need for timeout.
|
||||
*/
|
||||
WaitLatch(&MyProc->procLatch, WL_LATCH_SET | WL_POSTMASTER_DEATH, -1);
|
||||
}
|
||||
@@ -422,8 +422,8 @@ SyncRepReleaseWaiters(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the lsn first so that when we wake backends they will release
|
||||
* up to this location.
|
||||
* Set the lsn first so that when we wake backends they will release up to
|
||||
* this location.
|
||||
*/
|
||||
if (XLByteLT(walsndctl->lsn[SYNC_REP_WAIT_WRITE], MyWalSnd->write))
|
||||
{
|
||||
@@ -477,8 +477,8 @@ SyncRepGetStandbyPriority(void)
|
||||
bool found = false;
|
||||
|
||||
/*
|
||||
* Since synchronous cascade replication is not allowed, we always
|
||||
* set the priority of cascading walsender to zero.
|
||||
* Since synchronous cascade replication is not allowed, we always set the
|
||||
* priority of cascading walsender to zero.
|
||||
*/
|
||||
if (am_cascading_walsender)
|
||||
return 0;
|
||||
@@ -517,7 +517,7 @@ SyncRepGetStandbyPriority(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Walk the specified queue from head. Set the state of any backends that
|
||||
* Walk the specified queue from head. Set the state of any backends that
|
||||
* need to be woken, remove them from the queue, and then wake them.
|
||||
* Pass all = true to wake whole queue; otherwise, just wake up to
|
||||
* the walsender's LSN.
|
||||
@@ -601,7 +601,7 @@ SyncRepUpdateSyncStandbysDefined(void)
|
||||
*/
|
||||
if (!sync_standbys_defined)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_SYNC_REP_WAIT_MODE; i++)
|
||||
SyncRepWakeQueue(true, i);
|
||||
|
@@ -752,8 +752,8 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
|
||||
|
||||
if (log_min_messages <= DEBUG2)
|
||||
elog(DEBUG2, "sendtime %s receipttime %s replication apply delay %d ms transfer latency %d ms",
|
||||
timestamptz_to_str(sendTime),
|
||||
timestamptz_to_str(lastMsgReceiptTime),
|
||||
GetReplicationApplyDelay(),
|
||||
GetReplicationTransferLatency());
|
||||
timestamptz_to_str(sendTime),
|
||||
timestamptz_to_str(lastMsgReceiptTime),
|
||||
GetReplicationApplyDelay(),
|
||||
GetReplicationTransferLatency());
|
||||
}
|
||||
|
@@ -252,8 +252,8 @@ GetReplicationApplyDelay(void)
|
||||
XLogRecPtr receivePtr;
|
||||
XLogRecPtr replayPtr;
|
||||
|
||||
long secs;
|
||||
int usecs;
|
||||
long secs;
|
||||
int usecs;
|
||||
|
||||
SpinLockAcquire(&walrcv->mutex);
|
||||
receivePtr = walrcv->receivedUpto;
|
||||
@@ -284,9 +284,9 @@ GetReplicationTransferLatency(void)
|
||||
TimestampTz lastMsgSendTime;
|
||||
TimestampTz lastMsgReceiptTime;
|
||||
|
||||
long secs = 0;
|
||||
int usecs = 0;
|
||||
int ms;
|
||||
long secs = 0;
|
||||
int usecs = 0;
|
||||
int ms;
|
||||
|
||||
SpinLockAcquire(&walrcv->mutex);
|
||||
lastMsgSendTime = walrcv->lastMsgSendTime;
|
||||
|
@@ -74,7 +74,8 @@ WalSnd *MyWalSnd = NULL;
|
||||
|
||||
/* Global state */
|
||||
bool am_walsender = false; /* Am I a walsender process ? */
|
||||
bool am_cascading_walsender = false; /* Am I cascading WAL to another standby ? */
|
||||
bool am_cascading_walsender = false; /* Am I cascading WAL to
|
||||
* another standby ? */
|
||||
|
||||
/* User-settable parameters for walsender */
|
||||
int max_wal_senders = 0; /* the maximum number of concurrent walsenders */
|
||||
@@ -372,31 +373,31 @@ StartReplication(StartReplicationCmd *cmd)
|
||||
SendPostmasterSignal(PMSIGNAL_ADVANCE_STATE_MACHINE);
|
||||
|
||||
/*
|
||||
* When promoting a cascading standby, postmaster sends SIGUSR2 to
|
||||
* any cascading walsenders to kill them. But there is a corner-case where
|
||||
* such walsender fails to receive SIGUSR2 and survives a standby promotion
|
||||
* unexpectedly. This happens when postmaster sends SIGUSR2 before
|
||||
* the walsender marks itself as a WAL sender, because postmaster sends
|
||||
* SIGUSR2 to only the processes marked as a WAL sender.
|
||||
* When promoting a cascading standby, postmaster sends SIGUSR2 to any
|
||||
* cascading walsenders to kill them. But there is a corner-case where
|
||||
* such walsender fails to receive SIGUSR2 and survives a standby
|
||||
* promotion unexpectedly. This happens when postmaster sends SIGUSR2
|
||||
* before the walsender marks itself as a WAL sender, because postmaster
|
||||
* sends SIGUSR2 to only the processes marked as a WAL sender.
|
||||
*
|
||||
* To avoid this corner-case, if recovery is NOT in progress even though
|
||||
* the walsender is cascading one, we do the same thing as SIGUSR2 signal
|
||||
* handler does, i.e., set walsender_ready_to_stop to true. Which causes
|
||||
* the walsender to end later.
|
||||
*
|
||||
* When terminating cascading walsenders, usually postmaster writes
|
||||
* the log message announcing the terminations. But there is a race condition
|
||||
* here. If there is no walsender except this process before reaching here,
|
||||
* postmaster thinks that there is no walsender and suppresses that
|
||||
* When terminating cascading walsenders, usually postmaster writes the
|
||||
* log message announcing the terminations. But there is a race condition
|
||||
* here. If there is no walsender except this process before reaching
|
||||
* here, postmaster thinks that there is no walsender and suppresses that
|
||||
* log message. To handle this case, we always emit that log message here.
|
||||
* This might cause duplicate log messages, but which is less likely to happen,
|
||||
* so it's not worth writing some code to suppress them.
|
||||
* This might cause duplicate log messages, but which is less likely to
|
||||
* happen, so it's not worth writing some code to suppress them.
|
||||
*/
|
||||
if (am_cascading_walsender && !RecoveryInProgress())
|
||||
{
|
||||
ereport(LOG,
|
||||
(errmsg("terminating walsender process to force cascaded standby "
|
||||
"to update timeline and reconnect")));
|
||||
(errmsg("terminating walsender process to force cascaded standby "
|
||||
"to update timeline and reconnect")));
|
||||
walsender_ready_to_stop = true;
|
||||
}
|
||||
|
||||
@@ -405,8 +406,8 @@ StartReplication(StartReplicationCmd *cmd)
|
||||
* log-shipping, since this is checked in PostmasterMain().
|
||||
*
|
||||
* NOTE: wal_level can only change at shutdown, so in most cases it is
|
||||
* difficult for there to be WAL data that we can still see that was written
|
||||
* at wal_level='minimal'.
|
||||
* difficult for there to be WAL data that we can still see that was
|
||||
* written at wal_level='minimal'.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -693,7 +694,7 @@ ProcessStandbyHSFeedbackMessage(void)
|
||||
* far enough to make reply.xmin wrap around. In that case the xmin we
|
||||
* set here would be "in the future" and have no effect. No point in
|
||||
* worrying about this since it's too late to save the desired data
|
||||
* anyway. Assuming that the standby sends us an increasing sequence of
|
||||
* anyway. Assuming that the standby sends us an increasing sequence of
|
||||
* xmins, this could only happen during the first reply cycle, else our
|
||||
* own xmin would prevent nextXid from advancing so far.
|
||||
*
|
||||
@@ -792,8 +793,8 @@ WalSndLoop(void)
|
||||
if (MyWalSnd->state == WALSNDSTATE_CATCHUP)
|
||||
{
|
||||
ereport(DEBUG1,
|
||||
(errmsg("standby \"%s\" has now caught up with primary",
|
||||
application_name)));
|
||||
(errmsg("standby \"%s\" has now caught up with primary",
|
||||
application_name)));
|
||||
WalSndSetState(WALSNDSTATE_STREAMING);
|
||||
}
|
||||
|
||||
@@ -810,7 +811,7 @@ WalSndLoop(void)
|
||||
if (caughtup && !pq_is_send_pending())
|
||||
{
|
||||
walsender_shutdown_requested = true;
|
||||
continue; /* don't want to wait more */
|
||||
continue; /* don't want to wait more */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -825,7 +826,7 @@ WalSndLoop(void)
|
||||
if (caughtup || pq_is_send_pending())
|
||||
{
|
||||
TimestampTz timeout = 0;
|
||||
long sleeptime = 10000; /* 10 s */
|
||||
long sleeptime = 10000; /* 10 s */
|
||||
int wakeEvents;
|
||||
|
||||
wakeEvents = WL_LATCH_SET | WL_POSTMASTER_DEATH |
|
||||
@@ -845,7 +846,7 @@ WalSndLoop(void)
|
||||
if (replication_timeout > 0)
|
||||
{
|
||||
timeout = TimestampTzPlusMilliseconds(last_reply_timestamp,
|
||||
replication_timeout);
|
||||
replication_timeout);
|
||||
sleeptime = 1 + (replication_timeout / 10);
|
||||
}
|
||||
|
||||
@@ -973,9 +974,9 @@ WalSndKill(int code, Datum arg)
|
||||
void
|
||||
XLogRead(char *buf, XLogRecPtr startptr, Size count)
|
||||
{
|
||||
char *p;
|
||||
char *p;
|
||||
XLogRecPtr recptr;
|
||||
Size nbytes;
|
||||
Size nbytes;
|
||||
uint32 lastRemovedLog;
|
||||
uint32 lastRemovedSeg;
|
||||
uint32 log;
|
||||
@@ -1087,9 +1088,9 @@ retry:
|
||||
}
|
||||
|
||||
/*
|
||||
* During recovery, the currently-open WAL file might be replaced with
|
||||
* the file of the same name retrieved from archive. So we always need
|
||||
* to check what we read was valid after reading into the buffer. If it's
|
||||
* During recovery, the currently-open WAL file might be replaced with the
|
||||
* file of the same name retrieved from archive. So we always need to
|
||||
* check what we read was valid after reading into the buffer. If it's
|
||||
* invalid, we try to open and read the file again.
|
||||
*/
|
||||
if (am_cascading_walsender)
|
||||
@@ -1294,8 +1295,8 @@ WalSndShutdownHandler(SIGNAL_ARGS)
|
||||
SetLatch(&MyWalSnd->latch);
|
||||
|
||||
/*
|
||||
* Set the standard (non-walsender) state as well, so that we can
|
||||
* abort things like do_pg_stop_backup().
|
||||
* Set the standard (non-walsender) state as well, so that we can abort
|
||||
* things like do_pg_stop_backup().
|
||||
*/
|
||||
InterruptPending = true;
|
||||
ProcDiePending = true;
|
||||
|
Reference in New Issue
Block a user