mirror of
https://github.com/postgres/postgres.git
synced 2025-07-09 22:41:56 +03:00
Initial pgindent and pgperltidy run for v14.
Also "make reformat-dat-files". The only change worthy of note is that pgindent messed up the formatting of launcher.c's struct LogicalRepWorkerId, which led me to notice that that struct wasn't used at all anymore, so I just took it out.
This commit is contained in:
@ -414,7 +414,7 @@ perform_base_backup(basebackup_options *opt)
|
||||
if (ti->path == NULL)
|
||||
{
|
||||
struct stat statbuf;
|
||||
bool sendtblspclinks = true;
|
||||
bool sendtblspclinks = true;
|
||||
|
||||
/* In the main tar, include the backup_label first... */
|
||||
sendFileWithContent(BACKUP_LABEL_FILE, labelfile->data,
|
||||
|
@ -67,12 +67,6 @@ typedef struct LogicalRepCtxStruct
|
||||
|
||||
LogicalRepCtxStruct *LogicalRepCtx;
|
||||
|
||||
typedef struct LogicalRepWorkerId
|
||||
{
|
||||
Oid subid;
|
||||
Oid relid;
|
||||
} LogicalRepWorkerId;
|
||||
|
||||
static void ApplyLauncherWakeup(void);
|
||||
static void logicalrep_launcher_onexit(int code, Datum arg);
|
||||
static void logicalrep_worker_onexit(int code, Datum arg);
|
||||
@ -283,7 +277,7 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
|
||||
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("starting logical replication worker for subscription \"%s\"",
|
||||
subname)));
|
||||
subname)));
|
||||
|
||||
/* Report this after the initial starting message for consistency. */
|
||||
if (max_replication_slots == 0)
|
||||
|
@ -576,8 +576,8 @@ CheckPointReplicationOrigin(void)
|
||||
tmppath)));
|
||||
|
||||
/*
|
||||
* no other backend can perform this at the same time; only one
|
||||
* checkpoint can happen at a time.
|
||||
* no other backend can perform this at the same time; only one checkpoint
|
||||
* can happen at a time.
|
||||
*/
|
||||
tmpfd = OpenTransientFile(tmppath,
|
||||
O_CREAT | O_EXCL | O_WRONLY | PG_BINARY);
|
||||
|
@ -2493,11 +2493,11 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, ReorderBufferTXN *txn,
|
||||
* need to do the cleanup and return gracefully on this error, see
|
||||
* SetupCheckXidLive.
|
||||
*
|
||||
* This error code can be thrown by one of the callbacks we call during
|
||||
* decoding so we need to ensure that we return gracefully only when we are
|
||||
* sending the data in streaming mode and the streaming is not finished yet
|
||||
* or when we are sending the data out on a PREPARE during a two-phase
|
||||
* commit.
|
||||
* This error code can be thrown by one of the callbacks we call
|
||||
* during decoding so we need to ensure that we return gracefully only
|
||||
* when we are sending the data in streaming mode and the streaming is
|
||||
* not finished yet or when we are sending the data out on a PREPARE
|
||||
* during a two-phase commit.
|
||||
*/
|
||||
if (errdata->sqlerrcode == ERRCODE_TRANSACTION_ROLLBACK &&
|
||||
(stream_started || rbtxn_prepared(txn)))
|
||||
|
@ -1395,8 +1395,8 @@ SnapBuildWaitSnapshot(xl_running_xacts *running, TransactionId cutoff)
|
||||
/*
|
||||
* All transactions we needed to finish finished - try to ensure there is
|
||||
* another xl_running_xacts record in a timely manner, without having to
|
||||
* wait for bgwriter or checkpointer to log one. During recovery we
|
||||
* can't enforce that, so we'll have to wait.
|
||||
* wait for bgwriter or checkpointer to log one. During recovery we can't
|
||||
* enforce that, so we'll have to wait.
|
||||
*/
|
||||
if (!RecoveryInProgress())
|
||||
{
|
||||
|
@ -99,8 +99,8 @@ ReplicationSlot *MyReplicationSlot = NULL;
|
||||
int max_replication_slots = 0; /* the maximum number of replication
|
||||
* slots */
|
||||
|
||||
static int ReplicationSlotAcquireInternal(ReplicationSlot *slot,
|
||||
const char *name, SlotAcquireBehavior behavior);
|
||||
static int ReplicationSlotAcquireInternal(ReplicationSlot *slot,
|
||||
const char *name, SlotAcquireBehavior behavior);
|
||||
static void ReplicationSlotDropAcquired(void);
|
||||
static void ReplicationSlotDropPtr(ReplicationSlot *slot);
|
||||
|
||||
@ -451,8 +451,8 @@ retry:
|
||||
|
||||
/*
|
||||
* If we found the slot but it's already active in another process, we
|
||||
* either error out, return the PID of the owning process, or retry
|
||||
* after a short wait, as caller specified.
|
||||
* either error out, return the PID of the owning process, or retry after
|
||||
* a short wait, as caller specified.
|
||||
*/
|
||||
if (active_pid != MyProcPid)
|
||||
{
|
||||
@ -471,7 +471,7 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
else if (behavior == SAB_Block)
|
||||
ConditionVariableCancelSleep(); /* no sleep needed after all */
|
||||
ConditionVariableCancelSleep(); /* no sleep needed after all */
|
||||
|
||||
/* Let everybody know we've modified this slot */
|
||||
ConditionVariableBroadcast(&s->active_cv);
|
||||
@ -1180,8 +1180,8 @@ restart:
|
||||
ReplicationSlot *s = &ReplicationSlotCtl->replication_slots[i];
|
||||
XLogRecPtr restart_lsn = InvalidXLogRecPtr;
|
||||
NameData slotname;
|
||||
int wspid;
|
||||
int last_signaled_pid = 0;
|
||||
int wspid;
|
||||
int last_signaled_pid = 0;
|
||||
|
||||
if (!s->in_use)
|
||||
continue;
|
||||
@ -1204,20 +1204,20 @@ restart:
|
||||
/*
|
||||
* Try to mark this slot as used by this process.
|
||||
*
|
||||
* Note that ReplicationSlotAcquireInternal(SAB_Inquire)
|
||||
* should not cancel the prepared condition variable
|
||||
* if this slot is active in other process. Because in this case
|
||||
* we have to wait on that CV for the process owning
|
||||
* the slot to be terminated, later.
|
||||
* Note that ReplicationSlotAcquireInternal(SAB_Inquire) should
|
||||
* not cancel the prepared condition variable if this slot is
|
||||
* active in other process. Because in this case we have to wait
|
||||
* on that CV for the process owning the slot to be terminated,
|
||||
* later.
|
||||
*/
|
||||
wspid = ReplicationSlotAcquireInternal(s, NULL, SAB_Inquire);
|
||||
|
||||
/*
|
||||
* Exit the loop if we successfully acquired the slot or
|
||||
* the slot was dropped during waiting for the owning process
|
||||
* to be terminated. For example, the latter case is likely to
|
||||
* happen when the slot is temporary because it's automatically
|
||||
* dropped by the termination of the owning process.
|
||||
* Exit the loop if we successfully acquired the slot or the slot
|
||||
* was dropped during waiting for the owning process to be
|
||||
* terminated. For example, the latter case is likely to happen
|
||||
* when the slot is temporary because it's automatically dropped
|
||||
* by the termination of the owning process.
|
||||
*/
|
||||
if (wspid <= 0)
|
||||
break;
|
||||
@ -1225,13 +1225,13 @@ restart:
|
||||
/*
|
||||
* Signal to terminate the process that owns the slot.
|
||||
*
|
||||
* There is the race condition where other process may own
|
||||
* the slot after the process using it was terminated and before
|
||||
* this process owns it. To handle this case, we signal again
|
||||
* if the PID of the owning process is changed than the last.
|
||||
* There is the race condition where other process may own the
|
||||
* slot after the process using it was terminated and before this
|
||||
* process owns it. To handle this case, we signal again if the
|
||||
* PID of the owning process is changed than the last.
|
||||
*
|
||||
* XXX This logic assumes that the same PID is not reused
|
||||
* very quickly.
|
||||
* XXX This logic assumes that the same PID is not reused very
|
||||
* quickly.
|
||||
*/
|
||||
if (last_signaled_pid != wspid)
|
||||
{
|
||||
@ -1248,8 +1248,8 @@ restart:
|
||||
ConditionVariableCancelSleep();
|
||||
|
||||
/*
|
||||
* Do nothing here and start from scratch if the slot has
|
||||
* already been dropped.
|
||||
* Do nothing here and start from scratch if the slot has already been
|
||||
* dropped.
|
||||
*/
|
||||
if (wspid == -1)
|
||||
goto restart;
|
||||
|
@ -415,11 +415,11 @@ pg_get_replication_slots(PG_FUNCTION_ARGS)
|
||||
nulls[i++] = true;
|
||||
else
|
||||
{
|
||||
XLogSegNo targetSeg;
|
||||
uint64 slotKeepSegs;
|
||||
uint64 keepSegs;
|
||||
XLogSegNo failSeg;
|
||||
XLogRecPtr failLSN;
|
||||
XLogSegNo targetSeg;
|
||||
uint64 slotKeepSegs;
|
||||
uint64 keepSegs;
|
||||
XLogSegNo failSeg;
|
||||
XLogRecPtr failLSN;
|
||||
|
||||
XLByteToSeg(slot_contents.data.restart_lsn, targetSeg, wal_segment_size);
|
||||
|
||||
|
@ -165,12 +165,11 @@ SyncRepWaitForLSN(XLogRecPtr lsn, bool commit)
|
||||
* Since this routine gets called every commit time, it's important to
|
||||
* exit quickly if sync replication is not requested. So we check
|
||||
* WalSndCtl->sync_standbys_defined flag without the lock and exit
|
||||
* immediately if it's false. If it's true, we need to check it again later
|
||||
* while holding the lock, to check the flag and operate the sync rep
|
||||
* queue atomically. This is necessary to avoid the race condition
|
||||
* described in SyncRepUpdateSyncStandbysDefined(). On the other
|
||||
* hand, if it's false, the lock is not necessary because we don't touch
|
||||
* the queue.
|
||||
* immediately if it's false. If it's true, we need to check it again
|
||||
* later while holding the lock, to check the flag and operate the sync
|
||||
* rep queue atomically. This is necessary to avoid the race condition
|
||||
* described in SyncRepUpdateSyncStandbysDefined(). On the other hand, if
|
||||
* it's false, the lock is not necessary because we don't touch the queue.
|
||||
*/
|
||||
if (!SyncRepRequested() ||
|
||||
!((volatile WalSndCtlData *) WalSndCtl)->sync_standbys_defined)
|
||||
@ -426,7 +425,7 @@ SyncRepInitConfig(void)
|
||||
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("standby \"%s\" now has synchronous standby priority %u",
|
||||
application_name, priority)));
|
||||
application_name, priority)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -747,8 +747,8 @@ WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last)
|
||||
writeTimeLineHistoryFile(tli, content, len);
|
||||
|
||||
/*
|
||||
* Mark the streamed history file as ready for archiving
|
||||
* if archive_mode is always.
|
||||
* Mark the streamed history file as ready for archiving if
|
||||
* archive_mode is always.
|
||||
*/
|
||||
if (XLogArchiveMode != ARCHIVE_MODE_ALWAYS)
|
||||
XLogArchiveForceDone(fname);
|
||||
|
@ -2326,7 +2326,7 @@ WalSndLoop(WalSndSendDataCallback send_data)
|
||||
{
|
||||
ereport(DEBUG1,
|
||||
(errmsg_internal("\"%s\" has now caught up with upstream server",
|
||||
application_name)));
|
||||
application_name)));
|
||||
WalSndSetState(WALSNDSTATE_STREAMING);
|
||||
}
|
||||
|
||||
@ -3139,7 +3139,7 @@ WalSndWakeup(void)
|
||||
static void
|
||||
WalSndWait(uint32 socket_events, long timeout, uint32 wait_event)
|
||||
{
|
||||
WaitEvent event;
|
||||
WaitEvent event;
|
||||
|
||||
ModifyWaitEvent(FeBeWaitSet, FeBeWaitSetSocketPos, socket_events, NULL);
|
||||
if (WaitEventSetWait(FeBeWaitSet, timeout, &event, 1, wait_event) == 1 &&
|
||||
|
Reference in New Issue
Block a user