Skip to content

Commit dcd052c

Browse files
committed
Fix pg_atomic_u64 initialization.
As Andres pointed out, pg_atomic_init_u64 must be used to initialize an atomic variable, before it can be accessed with the actual atomic ops. Trying to use pg_atomic_write_u64 on an uninitialized variable leads to a failure with the fallback implementation that uses a spinlock. Discussion: https://www.postgresql.org/message-id/20170816191346.d3ke5tpshhco4bnd%40alap3.anarazel.de
1 parent ec0a69e commit dcd052c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/access/heap/heapam.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ heap_parallelscan_initialize(ParallelHeapScanDesc target, Relation relation,
16381638
target->phs_nblocks > NBuffers / 4;
16391639
SpinLockInit(&target->phs_mutex);
16401640
target->phs_startblock = InvalidBlockNumber;
1641-
pg_atomic_write_u64(&target->phs_nallocated, 0);
1641+
pg_atomic_init_u64(&target->phs_nallocated, 0);
16421642
SerializeSnapshot(snapshot, target->phs_snapshot_data);
16431643
}
16441644

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy