diff options
author | Robert Haas | 2022-04-12 18:45:23 +0000 |
---|---|---|
committer | Robert Haas | 2022-04-12 18:45:23 +0000 |
commit | 7fc0e7de9fb8306e84d1c15211aba4308f694455 (patch) | |
tree | ce8d0213123959bce52699e8e8d837d46758a2f6 /src/backend/commands | |
parent | 2c9381840fe2d6d1c3179350493fe5fd3dcf90b5 (diff) |
Revert the addition of GetMaxBackends() and related stuff.
This reverts commits 0147fc7, 4567596, aa64f23, and 5ecd018.
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
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/async.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 455d895a44a..3e1b92df030 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -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); |