Re: LogwrtResult contended spinlock

Alexander Law <exclusion@gmail.com>

From: Alexander Lakhin <exclusion@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, Jeff Davis <pgsql@j-davis.com>, pgsql-hackers@lists.postgresql.org, Jaime Casanova <jcasanov@systemguards.com.ec>
Date: 2024-06-29T07:00:00Z
Lists: pgsql-hackers
Hello Alvaro and Bharath,

07.04.2024 15:19, Alvaro Herrera wrote:
> I pushed the "copy" pointer now, except that I renamed it to "insert",
> which is what we call the operation being tracked.  I also added some
> comments.

I've discovered that Windows x86 build fails tests after commit f3ff7bf83.
Using "x86 Native Tools Command Prompt for VS 2022", I do:
meson setup build -Dcassert=true
cd build
ninja
meson test --suite setup

and get:
1/3 postgresql:setup / tmp_install               OK 1.56s
2/3 postgresql:setup / install_test_files        OK 0.09s
3/3 postgresql:setup / initdb_cache              FAIL 1.88s   exit status 1

testlog.txt contains:
running bootstrap script ...
----------------------------------- stderr -----------------------------------
TRAP: failed Assert("TYPEALIGN(8, (uintptr_t)(&currval)) == (uintptr_t)(&currval)"), File: 
"...\src\include\port/atomics.h", Line: 597, PID: 7556
child process was terminated by exception 0xC0000409

On f3ff7bf83~1, `meson test --suite setup` passes for me.

(I could not find if support for 32-bit Windows ended, so decided to
report this.)

Best regards,
Alexander



Commits

  1. Remove bogus assertion in pg_atomic_monotonic_advance_u64

  2. Add XLogCtl->logInsertResult

  3. Operate XLogCtl->log{Write,Flush}Result with atomics

  4. Split XLogCtl->LogwrtResult into separate struct members

  5. Introduce atomic read/write functions with full barrier semantics.

  6. Reduce the number of GetFlushRecPtr() calls done by walsenders.

  7. Remove most volatile qualifiers from xlog.c