agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH v31 01/11] Add a syntax to create Incrementally Maintainable Materialized Views
194+ messages / 2 participants
[nested] [flat]
* [PATCH v31 01/11] Add a syntax to create Incrementally Maintainable Materialized Views
@ 2019-12-20 01:05 Yugo Nagata <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Yugo Nagata @ 2019-12-20 01:05 UTC (permalink / raw)
Allow to create Incrementally Maintainable Materialized View (IMMV)
by using INCREMENTAL option in CREATE MATERIALIZED VIEW command
as follow:
CREATE [INCREMANTAL] MATERIALIZED VIEW xxxxx AS SELECT ....;
---
src/backend/parser/gram.y | 32 +++++++++++++++++++++-----------
src/include/nodes/primnodes.h | 1 +
src/include/parser/kwlist.h | 1 +
3 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index c1b0cff1c9..3a4746a22b 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -467,6 +467,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
%type <range> OptTempTableName
%type <into> into_clause create_as_target create_mv_target
+%type <boolean> incremental
%type <defelt> createfunc_opt_item common_func_opt_item dostmt_opt_item
%type <fun_param> func_arg func_arg_with_default table_func_column aggr_arg
@@ -730,7 +731,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
HANDLER HAVING HEADER_P HOLD HOUR_P
IDENTITY_P IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IMPORT_P IN_P INCLUDE
- INCLUDING INCREMENT INDENT INDEX INDEXES INHERIT INHERITS INITIALLY INLINE_P
+ INCLUDING INCREMENT INCREMENTAL INDENT INDEX INDEXES INHERIT INHERITS INITIALLY INLINE_P
INNER_P INOUT INPUT_P INSENSITIVE INSERT INSTEAD INT_P INTEGER
INTERSECT INTERVAL INTO INVOKER IS ISNULL ISOLATION
@@ -4732,32 +4733,34 @@ opt_with_data:
*****************************************************************************/
CreateMatViewStmt:
- CREATE OptNoLog MATERIALIZED VIEW create_mv_target AS SelectStmt opt_with_data
+ CREATE OptNoLog incremental MATERIALIZED VIEW create_mv_target AS SelectStmt opt_with_data
{
CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt);
- ctas->query = $7;
- ctas->into = $5;
+ ctas->query = $8;
+ ctas->into = $6;
ctas->objtype = OBJECT_MATVIEW;
ctas->is_select_into = false;
ctas->if_not_exists = false;
/* cram additional flags into the IntoClause */
- $5->rel->relpersistence = $2;
- $5->skipData = !($8);
+ $6->rel->relpersistence = $2;
+ $6->skipData = !($9);
+ $6->ivm = $3;
$$ = (Node *) ctas;
}
- | CREATE OptNoLog MATERIALIZED VIEW IF_P NOT EXISTS create_mv_target AS SelectStmt opt_with_data
+ | CREATE OptNoLog incremental MATERIALIZED VIEW IF_P NOT EXISTS create_mv_target AS SelectStmt opt_with_data
{
CreateTableAsStmt *ctas = makeNode(CreateTableAsStmt);
- ctas->query = $10;
- ctas->into = $8;
+ ctas->query = $11;
+ ctas->into = $9;
ctas->objtype = OBJECT_MATVIEW;
ctas->is_select_into = false;
ctas->if_not_exists = true;
/* cram additional flags into the IntoClause */
- $8->rel->relpersistence = $2;
- $8->skipData = !($11);
+ $9->rel->relpersistence = $2;
+ $9->skipData = !($12);
+ $9->ivm = $3;
$$ = (Node *) ctas;
}
;
@@ -4774,9 +4777,14 @@ create_mv_target:
$$->tableSpaceName = $5;
$$->viewQuery = NULL; /* filled at analysis time */
$$->skipData = false; /* might get changed later */
+ $$->ivm = false;
}
;
+incremental: INCREMENTAL { $$ = true; }
+ | /*EMPTY*/ { $$ = false; }
+ ;
+
OptNoLog: UNLOGGED { $$ = RELPERSISTENCE_UNLOGGED; }
| /*EMPTY*/ { $$ = RELPERSISTENCE_PERMANENT; }
;
@@ -17436,6 +17444,7 @@ unreserved_keyword:
| INCLUDE
| INCLUDING
| INCREMENT
+ | INCREMENTAL
| INDENT
| INDEX
| INDEXES
@@ -18017,6 +18026,7 @@ bare_label_keyword:
| INCLUDE
| INCLUDING
| INCREMENT
+ | INCREMENTAL
| INDENT
| INDEX
| INDEXES
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 376f67e6a5..f7bcf78cf2 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -154,6 +154,7 @@ typedef struct IntoClause
/* materialized view's SELECT query */
Node *viewQuery pg_node_attr(query_jumble_ignore);
bool skipData; /* true for WITH NO DATA */
+ bool ivm; /* true for WITH IVM */
} IntoClause;
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index 57514d064b..f146d7c41a 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -210,6 +210,7 @@ PG_KEYWORD("in", IN_P, RESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("include", INCLUDE, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("including", INCLUDING, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("increment", INCREMENT, UNRESERVED_KEYWORD, BARE_LABEL)
+PG_KEYWORD("incremental", INCREMENTAL, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("indent", INDENT, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("index", INDEX, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("indexes", INDEXES, UNRESERVED_KEYWORD, BARE_LABEL)
--
2.25.1
--Multipart=_Fri__29_Mar_2024_23_47_00_+0900_KGpmmDOIs1266Ib1
Content-Type: text/x-diff;
name="v31-0002-Add-relisivm-column-to-pg_class-system-catalog.patch"
Content-Disposition: attachment;
filename="v31-0002-Add-relisivm-column-to-pg_class-system-catalog.patch"
Content-Transfer-Encoding: 7bit
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
* [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic
@ 2026-07-09 18:38 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 194+ messages in thread
From: Nathan Bossart @ 2026-07-09 18:38 UTC (permalink / raw)
---
src/backend/executor/nodeBitmapHeapscan.c | 21 ++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 83d6478bc2b..f2bb487bf10 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -79,7 +79,6 @@ typedef enum
/* ----------------
* ParallelBitmapHeapState information
* tbmiterator iterator for scanning current pages
- * mutex mutual exclusion for state
* state current state of the TIDBitmap
* cv conditional wait variable
* ----------------
@@ -87,8 +86,7 @@ typedef enum
typedef struct ParallelBitmapHeapState
{
dsa_pointer tbmiterator;
- slock_t mutex;
- SharedBitmapState state;
+ pg_atomic_uint32 state;
ConditionVariable cv;
} ParallelBitmapHeapState;
@@ -228,9 +226,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
static inline void
BitmapDoneInitializingSharedState(ParallelBitmapHeapState *pstate)
{
- SpinLockAcquire(&pstate->mutex);
- pstate->state = BM_FINISHED;
- SpinLockRelease(&pstate->mutex);
+ pg_atomic_write_membarrier_u32(&pstate->state, BM_FINISHED);
ConditionVariableBroadcast(&pstate->cv);
}
@@ -480,11 +476,8 @@ BitmapShouldInitializeSharedState(ParallelBitmapHeapState *pstate)
while (1)
{
- SpinLockAcquire(&pstate->mutex);
- state = pstate->state;
- if (pstate->state == BM_INITIAL)
- pstate->state = BM_INPROGRESS;
- SpinLockRelease(&pstate->mutex);
+ state = BM_INITIAL;
+ pg_atomic_compare_exchange_u32(&pstate->state, &state, BM_INPROGRESS);
/* Exit if bitmap is done, or if we're the leader. */
if (state != BM_INPROGRESS)
@@ -538,9 +531,7 @@ ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node,
pstate->tbmiterator = 0;
- /* Initialize the mutex */
- SpinLockInit(&pstate->mutex);
- pstate->state = BM_INITIAL;
+ pg_atomic_init_u32(&pstate->state, BM_INITIAL);
ConditionVariableInit(&pstate->cv);
@@ -565,7 +556,7 @@ ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
if (dsa == NULL)
return;
- pstate->state = BM_INITIAL;
+ pg_atomic_write_u32(&pstate->state, BM_INITIAL);
if (DsaPointerIsValid(pstate->tbmiterator))
tbm_free_shared_area(dsa, pstate->tbmiterator);
--
2.50.1 (Apple Git-155)
--Ot5x3ffkWEuxilWO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
filename=v1-0003-convert-FixedParallelState-last_xlog_end-to-an-at.patch
^ permalink raw reply [nested|flat] 194+ messages in thread
end of thread, other threads:[~2026-07-09 18:38 UTC | newest]
Thread overview: 194+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 01:05 [PATCH v31 01/11] Add a syntax to create Incrementally Maintainable Materialized Views Yugo Nagata <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
2026-07-09 18:38 [PATCH v1 2/8] convert ParallelBitmapHeapState->state to an atomic Nathan Bossart <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox