File tree Expand file tree Collapse file tree 6 files changed +17
-14
lines changed Expand file tree Collapse file tree 6 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 8080#include "pg_trace.h"
8181#include "pgstat.h"
8282#include "port/pg_bitutils.h"
83- #include "postmaster/postmaster.h"
8483#include "storage/proc.h"
8584#include "storage/proclist.h"
85+ #include "storage/procnumber.h"
8686#include "storage/spin.h"
8787#include "utils/memutils.h"
8888
Original file line number Diff line number Diff line change 3232#include "lib/qunique.h"
3333#include "libpq/pqformat.h"
3434#include "miscadmin.h"
35- #include "postmaster/postmaster.h"
3635#include "storage/lwlock.h"
3736#include "storage/procarray.h"
37+ #include "storage/procnumber.h"
3838#include "utils/builtins.h"
3939#include "utils/memutils.h"
4040#include "utils/snapmgr.h"
Original file line number Diff line number Diff line change 4949#include "storage/lmgr.h"
5050#include "storage/proc.h"
5151#include "storage/procarray.h"
52+ #include "storage/procnumber.h"
5253#include "storage/procsignal.h"
5354#include "storage/sinvaladt.h"
5455#include "storage/smgr.h"
Original file line number Diff line number Diff line change 7777#include "storage/large_object.h"
7878#include "storage/pg_shmem.h"
7979#include "storage/predicate.h"
80+ #include "storage/procnumber.h"
8081#include "storage/standby.h"
8182#include "tcop/backend_startup.h"
8283#include "tcop/tcopprot.h"
Original file line number Diff line number Diff line change @@ -126,18 +126,6 @@ extern PMChild *AllocDeadEndChild(void);
126126extern bool ReleasePostmasterChildSlot (PMChild * pmchild );
127127extern PMChild * FindPostmasterChildByPid (int pid );
128128
129- /*
130- * Note: MAX_BACKENDS is limited to 2^18-1 because that's the width reserved
131- * for buffer references in buf_internals.h. This limitation could be lifted
132- * by using a 64bit state; but it's unlikely to be worthwhile as 2^18-1
133- * backends exceed currently realistic configurations. Even if that limitation
134- * were removed, we still could not a) exceed 2^23-1 because inval.c stores
135- * the ProcNumber as a 3-byte signed integer, b) INT_MAX/4 because some places
136- * compute 4*MaxBackends without any overflow check. This is rechecked in the
137- * relevant GUC check hooks and in RegisterBackgroundWorker().
138- */
139- #define MAX_BACKENDS 0x3FFFF
140-
141129/*
142130 * These values correspond to the special must-be-first options for dispatching
143131 * to various subprograms. parse_dispatch_option() can be used to convert an
Original file line number Diff line number Diff line change @@ -25,6 +25,19 @@ typedef int ProcNumber;
2525
2626#define INVALID_PROC_NUMBER (-1)
2727
28+ /*
29+ * Note: MAX_BACKENDS_BITS is 18 as that is the space available for buffer
30+ * refcounts in buf_internals.h. This limitation could be lifted by using a
31+ * 64bit state; but it's unlikely to be worthwhile as 2^18-1 backends exceed
32+ * currently realistic configurations. Even if that limitation were removed,
33+ * we still could not a) exceed 2^23-1 because inval.c stores the ProcNumber
34+ * as a 3-byte signed integer, b) INT_MAX/4 because some places compute
35+ * 4*MaxBackends without any overflow check. This is rechecked in the
36+ * relevant GUC check hooks and in RegisterBackgroundWorker().
37+ */
38+ #define MAX_BACKENDS_BITS 18
39+ #define MAX_BACKENDS ((1U << MAX_BACKENDS_BITS)-1)
40+
2841/*
2942 * Proc number of this backend (same as GetNumberFromPGProc(MyProc))
3043 */
You can’t perform that action at this time.
0 commit comments