mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Revert the addition of GetMaxBackends() and related stuff.
This reverts commits0147fc7
,4567596
,aa64f23
, and5ecd018
. There is no longer agreement that introducing this function was the right way to address the problem. The consensus now seems to favor trying to make a correct value for MaxBackends available to mdules executing their _PG_init() functions. Nathan Bossart Discussion: http://postgr.es/m/20220323045229.i23skfscdbvrsuxa@jrouhaud
This commit is contained in:
@ -518,7 +518,7 @@ AsyncShmemSize(void)
|
||||
Size size;
|
||||
|
||||
/* This had better match AsyncShmemInit */
|
||||
size = mul_size(GetMaxBackends() + 1, sizeof(QueueBackendStatus));
|
||||
size = mul_size(MaxBackends + 1, sizeof(QueueBackendStatus));
|
||||
size = add_size(size, offsetof(AsyncQueueControl, backend));
|
||||
|
||||
size = add_size(size, SimpleLruShmemSize(NUM_NOTIFY_BUFFERS, 0));
|
||||
@ -534,7 +534,6 @@ AsyncShmemInit(void)
|
||||
{
|
||||
bool found;
|
||||
Size size;
|
||||
int max_backends = GetMaxBackends();
|
||||
|
||||
/*
|
||||
* Create or attach to the AsyncQueueControl structure.
|
||||
@ -542,7 +541,7 @@ AsyncShmemInit(void)
|
||||
* The used entries in the backend[] array run from 1 to MaxBackends; the
|
||||
* zero'th entry is unused but must be allocated.
|
||||
*/
|
||||
size = mul_size(max_backends + 1, sizeof(QueueBackendStatus));
|
||||
size = mul_size(MaxBackends + 1, sizeof(QueueBackendStatus));
|
||||
size = add_size(size, offsetof(AsyncQueueControl, backend));
|
||||
|
||||
asyncQueueControl = (AsyncQueueControl *)
|
||||
@ -557,7 +556,7 @@ AsyncShmemInit(void)
|
||||
QUEUE_FIRST_LISTENER = InvalidBackendId;
|
||||
asyncQueueControl->lastQueueFillWarn = 0;
|
||||
/* zero'th entry won't be used, but let's initialize it anyway */
|
||||
for (int i = 0; i <= max_backends; i++)
|
||||
for (int i = 0; i <= MaxBackends; i++)
|
||||
{
|
||||
QUEUE_BACKEND_PID(i) = InvalidPid;
|
||||
QUEUE_BACKEND_DBOID(i) = InvalidOid;
|
||||
@ -1633,7 +1632,6 @@ SignalBackends(void)
|
||||
int32 *pids;
|
||||
BackendId *ids;
|
||||
int count;
|
||||
int max_backends = GetMaxBackends();
|
||||
|
||||
/*
|
||||
* Identify backends that we need to signal. We don't want to send
|
||||
@ -1643,8 +1641,8 @@ SignalBackends(void)
|
||||
* XXX in principle these pallocs could fail, which would be bad. Maybe
|
||||
* preallocate the arrays? They're not that large, though.
|
||||
*/
|
||||
pids = (int32 *) palloc(max_backends * sizeof(int32));
|
||||
ids = (BackendId *) palloc(max_backends * sizeof(BackendId));
|
||||
pids = (int32 *) palloc(MaxBackends * sizeof(int32));
|
||||
ids = (BackendId *) palloc(MaxBackends * sizeof(BackendId));
|
||||
count = 0;
|
||||
|
||||
LWLockAcquire(NotifyQueueLock, LW_EXCLUSIVE);
|
||||
|
Reference in New Issue
Block a user