Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ba1868b

Browse files
Minor bug fix and cleanup from self-review of sync rep queues patch.
1 parent 73f617f commit ba1868b

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/backend/postmaster/checkpointer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ CheckpointWriteDelay(int flags, double progress)
673673
got_SIGHUP = false;
674674
ProcessConfigFile(PGC_SIGHUP);
675675
/* update global shmem state for sync rep */
676-
SyncRepUpdateSyncStandbysDefined();
676+
UpdateSharedMemoryConfig();
677677
}
678678

679679
AbsorbFsyncRequests();

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4212,13 +4212,13 @@ sigusr1_handler(SIGNAL_ARGS)
42124212
FatalError = false;
42134213

42144214
/*
4215-
* Crank up the background writer. It doesn't matter if this fails,
4215+
* Crank up the background writers. It doesn't matter if this fails,
42164216
* we'll just try again later.
42174217
*/
4218-
Assert(BgWriterPID == 0);
4219-
BgWriterPID = StartBackgroundWriter();
42204218
Assert(CheckpointerPID == 0);
42214219
CheckpointerPID = StartCheckpointer();
4220+
Assert(BgWriterPID == 0);
4221+
BgWriterPID = StartBackgroundWriter();
42224222

42234223
pmState = PM_RECOVERY;
42244224
}

src/backend/replication/syncrep.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ char *SyncRepStandbyNames;
6262
#define SyncStandbysDefined() \
6363
(SyncRepStandbyNames != NULL && SyncRepStandbyNames[0] != '\0')
6464

65-
#define SyncRepRequested() \
66-
(max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH)
67-
6865
static bool announce_next_takeover = true;
6966

7067
static int SyncRepWaitMode = SYNC_REP_NO_WAIT;
@@ -98,6 +95,7 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
9895
{
9996
char *new_status = NULL;
10097
const char *old_status;
98+
int mode = SyncRepWaitMode;
10199

102100
/*
103101
* Fast exit if user has not requested sync replication, or there are no
@@ -122,7 +120,7 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
122120
* be a low cost check.
123121
*/
124122
if (!WalSndCtl->sync_standbys_defined ||
125-
XLByteLE(XactCommitLSN, WalSndCtl->lsn[SyncRepWaitMode]))
123+
XLByteLE(XactCommitLSN, WalSndCtl->lsn[mode]))
126124
{
127125
LWLockRelease(SyncRepLock);
128126
return;
@@ -134,8 +132,8 @@ SyncRepWaitForLSN(XLogRecPtr XactCommitLSN)
134132
*/
135133
MyProc->waitLSN = XactCommitLSN;
136134
MyProc->syncRepState = SYNC_REP_WAITING;
137-
SyncRepQueueInsert(SyncRepWaitMode);
138-
Assert(SyncRepQueueIsOrderedByLSN(SyncRepWaitMode));
135+
SyncRepQueueInsert(mode);
136+
Assert(SyncRepQueueIsOrderedByLSN(mode));
139137
LWLockRelease(SyncRepLock);
140138

141139
/* Alter ps display to show waiting for sync rep. */

0 commit comments

Comments
 (0)