Skip to content

Commit 8d1ec0a

Browse files
committed
Reject a sweep threshold outside the slot-table capacity
An override above SHARED_REGION_MAX_PROCESS_NUM would keep the sweep from ever running, so a table full of dead slots would reach the capacity check and exit -- the case this branch set out to make recoverable. Zero would sweep on every join and bring back the cost this branch removes. Catch both at compile time, since the override only exists for the regression test. Signed-off-by: keshav9926 <kkakani160@gmail.com>
1 parent ae98819 commit 8d1ec0a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/multiprocess/multiprocess_memory_limit.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
#ifndef SHARED_REGION_SWEEP_THRESHOLD
4747
#define SHARED_REGION_SWEEP_THRESHOLD ((SHARED_REGION_MAX_PROCESS_NUM * 3) / 4)
4848
#endif
49+
// Past capacity the sweep could never run, so a table full of dead slots would
50+
// reach the capacity check and exit. At zero every join sweeps again.
51+
#if SHARED_REGION_SWEEP_THRESHOLD < 1 || \
52+
SHARED_REGION_SWEEP_THRESHOLD > SHARED_REGION_MAX_PROCESS_NUM
53+
#error "SHARED_REGION_SWEEP_THRESHOLD must be between 1 and SHARED_REGION_MAX_PROCESS_NUM"
54+
#endif
4955

5056
// macros for debugging
5157
#define SEQ_FIX_SHRREG_ACQUIRE_FLOCK_OK 0

0 commit comments

Comments
 (0)