8000 Removed active backends logic · pct960/postgres@cc65c0d · GitHub
[go: up one dir, main page]

Skip to content

Commit cc65c0d

Browse files
committed
Removed active backends logic
1 parent 658c729 commit cc65c0d

File tree

4 files changed

+2
-74
lines changed

4 files changed

+2
-74
lines changed

src/backend/replication/syncrep.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ SyncRepGetSyncRecPtr(XLogRecPtr *writePtr, XLogRecPtr *flushPtr,
660660
*/
661661
if (!(*am_sync) || num_standbys < SyncRepConfig->num_sync)
662662
{
663-
elog(INFO, "Not enough standbys, returning. num_standbys = (%d), num_sync = (%d)", num_standbys, SyncRepConfig->num_sync);
663+
//elog(INFO, "Not enough standbys, returning. num_standbys = (%d), num_sync = (%d)", num_standbys, SyncRepConfig->num_sync);
664664
pfree(sync_standbys);
665665
return false;
666666
}
@@ -1110,7 +1110,7 @@ SyncRepWakeQueue(bool all, int mode)
11101110
* Assume the queue is ordered by LSN
11111111
*/
11121112

1113-
elog(INFO, "In SyncRepWakeQueue. walsndctl->lsn = (%d), proc->waitlsn = (%d)", walsndctl->lsn[mode], proc->waitLSN);
1113+
//elog(INFO, "In SyncRepWakeQueue. walsndctl->lsn = (%d), proc->waitlsn = (%d)", walsndctl->lsn[mode], proc->waitLSN);
11141114
if (!all && walsndctl->lsn[mode] < proc->waitLSN)
11151115
return numprocs;
11161116

@@ -1253,27 +1253,6 @@ SyncRepGetQueueLength(int mode)
12531253
return queueLength;
12541254
}
12551255

1256-
bool
1257-
areBackendsWaiting()
1258-
{
1259-
uint32 allProcCount = &ProcGlobal->allProcCount;
1260-
1261-
for(int i=0;i<allProcCount;i++)
1262-
{
1263-
PGPROC *backend = GetPGProcByNumber(i);
1264-
1265-
if(backend->pid == 0 || backend->backendId == 0)
1266-
continue;
1267-
1268-
elog(INFO, "waitLSN = (%d), syncRepState = (%d), xid = (%d), xmin = (%d)", backend->waitLSN, backend->syncRepState, backend->xid, backend->xmin);
1269-
1270-
if(backend->xid != InvalidXLogRecPtr && (backend->syncRepState == SYNC_REP_NOT_WAITING || backend->syncRepState == SYNC_REP_WAITING || backend->syncRepState == SYNC_REP_WAIT_COMPLETE))
1271-
return true;
1272-
1273-
}
1274-
return false;
1275-
}
1276-
12771256
/*
12781257
* ===========================================================
12791258
* Synchronous Replication functions executed by any process

src/backend/storage/ipc/procarray.c

Lines changed: 0 additions & 49 deletions
3568
Original file line numberDiff line numberDiff line change
@@ -3546,55 +3546,6 @@ MinimumActiveBackends(int min)
35463546
return count >= min;
35473547
}
35483548

3549-
bool
3550-
anyActiveBackends()
3551-
{
3552-
ProcArrayStruct *arrayP = procArray;
3553-
int count = 0;
3554-
int index;
3555-
3556-
/*
3557-
* Note: for speed, we don't acquire ProcArrayLock. This is a little bit
3558-
* bogus, but since we are only testing fields for zero or nonzero, it
3559-
* should be OK. The result is only used for heuristic purposes anyway...
3560-
*/
3561-
for (index = 0; index < arrayP->numProcs; index++)
3562-
{
3563-
int pgprocno = arrayP->pgprocnos[index];
3564-
PGPROC *proc = &allProcs[pgprocno];
3565-
3566-
/*
3567-
* Since we're not holding a lock, need to be prepared to deal with
-
* garbage, as someone could have incremented numProcs but not yet
3569-
* filled the structure.
3570-
*
3571-
* If someone just decremented numProcs, 'proc' could also point to a
3572-
* PGPROC entry that's no longer in the array. It still points to a
3573-
* PGPROC struct, though, because freed PGPROC entries just go to the
3574-
* free list and are recycled. Its contents are nonsense in that case,
3575-
* but that's acceptable for this function.
3576-
*/
3577-
if (pgprocno == -1)
3578-
continue; /* do not count deleted entries */
3579-
if (proc == MyProc)
3580-
continue; /* do not count myself */
3581-
if (proc->xid == InvalidTransactionId)
3582-
continue; /* do not count if no XID assigned */
3583-
if (proc->pid == 0)
3584-
continue; /* do not count prepared xacts */
3585-
//if (proc->waitLock != NULL)
3586-
// count++;
3587-
if (!SHMQueueEmpty(&(proc->syncRepLinks)) && proc->syncRepState == 1)
3588-
{
3589-
elog(INFO, "waitLSN = (%d), syncRepState = (%d), xid = (%d), xmin = (%d)", proc->waitLSN, proc->syncRepState, proc->xid, proc->xmin);
3590-
count++;
3591-
}
3592-
3593-
}
3594-
3595-
return count > 0;
3596-
}
3597-
35983549
/*
35993550
* CountDBBackends --- count backends that are using specified database
36003551
*/

src/include/replication/slot.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ extern bool ReplicationSlotsCountDBSlots(Oid dboid, int *nslots, int *nactive);
216216
extern void ReplicationSlotsDropDBSlots(Oid dboid);
217217
extern bool InvalidateObsoleteReplicationSlots(XLogSegNo oldestSegno);
218218
extern ReplicationSlot *SearchNamedReplicationSlot(const char *name, bool need_lock);
219-
extern bool anyActiveReplicationSlots();
220219
extern int ReplicationSlotIndex(ReplicationSlot *slot);
221220
extern bool ReplicationSlotName(int index, Name name);
222221
extern void ReplicationSlotNameForTablesync(Oid suboid, Oid relid, char *syncslotname, int szslot);

src/include/storage/procarray.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ extern pid_t SignalVirtualTransaction(VirtualTransactionId vxid, ProcSignalReaso
7777
bool conflictPending);
7878

7979
extern bool MinimumActiveBackends(int min);
80-
extern bool anyActiveBackends();
8180
extern int CountDBBackends(Oid databaseid);
8281
extern int CountDBConnections(Oid databaseid);
8382
extern void CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending);

0 commit comments

Comments
 (0)
0