Re: LogwrtResult contended spinlock
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@lists.postgresql.org, Jaime Casanova <jaime.casanova@2ndquadrant.com>
Date: 2021-11-18T22:15:58Z
Lists: pgsql-hackers
Attachments
- logwrt-4.patch (text/x-diff) patch
Here's a further attempt at this. Sorry it took so long. In this version, I replaced the coupled-in-a-struct representation of Write&Flush with two separate global variables. The reason to do this is to cater to Andres' idea to keep them up-to-date separately. Of course, I could kept them together, but it seems more sensible this way. Andres also suggested to not use monotonic-advance in XLogWrite, because these update are always done with WALWriteLock held in exclusive mode. However, that doesn't work (and tests fail pretty quickly) because XLogWrite seems to be called possibly out of order, so you still have to check if the current value is newer than what you have to write anyway; using stock atomic write doesn't work. So this is v4. -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/
Commits
-
Remove bogus assertion in pg_atomic_monotonic_advance_u64
- 768f0c3e21b3 18.0 landed
- 3a9d0d774d90 17.0 landed
-
Add XLogCtl->logInsertResult
- f3ff7bf83bce 17.0 cited
-
Operate XLogCtl->log{Write,Flush}Result with atomics
- ee1cbe806dad 17.0 landed
-
Split XLogCtl->LogwrtResult into separate struct members
- c9920a9068ea 17.0 landed
-
Introduce atomic read/write functions with full barrier semantics.
- bd5132db558b 17.0 cited
-
Reduce the number of GetFlushRecPtr() calls done by walsenders.
- e369f3708636 13.0 cited
-
Remove most volatile qualifiers from xlog.c
- 6ba4ecbf477e 9.5.0 cited