Convert unloggedLSN to an atomic variable.
commit963d3072af21afbcb1183b3c960135cc7df02f3f
authorNathan Bossart <nathan@postgresql.org>
Thu, 29 Feb 2024 20:34:10 +0000 (29 14:34 -0600)
committerNathan Bossart <nathan@postgresql.org>
Thu, 29 Feb 2024 20:34:10 +0000 (29 14:34 -0600)
tree95f67624ab4f71c046ca0dcd4afd22a22624c714
parent3179701505b9ec58243ffba9d22b1803f320bf60
Convert unloggedLSN to an atomic variable.

Currently, this variable is an XLogRecPtr protected by a spinlock.
By converting it to an atomic variable, we can remove the spinlock,
which saves a small amount of shared memory space.  Since this code
is not performance-critical, we use atomic operations with full
barrier semantics to make it easy to reason about correctness.

Author: John Morris
Reviewed-by: Michael Paquier, Robert Haas, Andres Freund, Stephen Frost, Bharath Rupireddy
Discussion: https://postgr.es/m/BYAPR13MB26772534335255E50318C574A0409%40BYAPR13MB2677.namprd13.prod.outlook.com
Discussion: https://postgr.es/m/MN2PR13MB2688FD8B757316CB5C54C8A2A0DDA%40MN2PR13MB2688.namprd13.prod.outlook.com
src/backend/access/transam/xlog.c