|
44 | 44 | #include"utils/builtins.h" |
45 | 45 | #include"utils/timestamp.h" |
46 | 46 | #include"storage/shm_toc.h" |
| 47 | +#include"postmaster/autovacuum.h" |
47 | 48 | #include"postmaster/interrupt.h" |
| 49 | +#include"replication/walsender.h" |
48 | 50 | #include"storage/shm_mq.h" |
49 | 51 | #include"storage/ipc.h" |
50 | 52 | #include"tcop/tcopprot.h" |
@@ -362,9 +364,13 @@ static Size |
362 | 364 | dmq_shmem_size(void) |
363 | 365 | { |
364 | 366 | Sizesize=0; |
| 367 | +intmaxbackends=0; |
| 368 | + |
| 369 | +maxbackends=MaxConnections+autovacuum_max_workers+ |
| 370 | +max_worker_processes+max_wal_senders+1; |
365 | 371 |
|
366 | 372 | size=add_size(size,sizeof(structDmqSharedState)); |
367 | | -size=add_size(size,hash_estimate_size(DMQ_MAX_SUBS_PER_BACKEND*MaxBackends, |
| 373 | +size=add_size(size,hash_estimate_size(DMQ_MAX_SUBS_PER_BACKEND*maxbackends, |
368 | 374 | sizeof(DmqStreamSubscription))); |
369 | 375 | returnMAXALIGN(size); |
370 | 376 | } |
|