File tree 6 files changed +17
-14
lines changed
6 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 80
80
#include "pg_trace.h"
81
81
#include "pgstat.h"
82
82
#include "port/pg_bitutils.h"
83
- #include "postmaster/postmaster.h"
84
83
#include "storage/proc.h"
85
84
#include "storage/proclist.h"
85
+ #include "storage/procnumber.h"
86
86
#include "storage/spin.h"
87
87
#include "utils/memutils.h"
88
88
Original file line number Diff line number Diff line change 32
32
#include "lib/qunique.h"
33
33
#include "libpq/pqformat.h"
34
34
#include "miscadmin.h"
35
- #include "postmaster/postmaster.h"
36
35
#include "storage/lwlock.h"
37
36
#include "storage/procarray.h"
37
+ #include "storage/procnumber.h"
38
38
#include "utils/builtins.h"
39
39
#include "utils/memutils.h"
40
40
#include "utils/snapmgr.h"
Original file line number Diff line number Diff line change 49
49
#include "storage/lmgr.h"
50
50
#include "storage/proc.h"
51
51
#include "storage/procarray.h"
52
+ #include "storage/procnumber.h"
52
53
#include "storage/procsignal.h"
53
54
#include "storage/sinvaladt.h"
54
55
#include "storage/smgr.h"
Original file line number Diff line number Diff line change 77
77
#include "storage/large_object.h"
78
78
#include "storage/pg_shmem.h"
79
79
#include "storage/predicate.h"
80
+ #include "storage/procnumber.h"
80
81
#include "storage/standby.h"
81
82
#include "tcop/backend_startup.h"
82
83
#include "tcop/tcopprot.h"
Original file line number Diff line number Diff line change @@ -126,18 +126,6 @@ extern PMChild *AllocDeadEndChild(void);
126
126
extern bool ReleasePostmasterChildSlot (PMChild * pmchild );
127
127
extern PMChild * FindPostmasterChildByPid (int pid );
128
128
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
-
141
129
/*
142
130
* These values correspond to the special must-be-first options for dispatching
143
131
* 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;
25
25
26
26
#define INVALID_PROC_NUMBER (-1)
27
27
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
+
28
41
/*
29
42
* Proc number of this backend (same as GetNumberFromPGProc(MyProc))
30
43
*/
You can’t perform that action at this time.
0 commit comments