Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation() - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()
Date
Msg-id CABOikdMD9tvETBAEDh+dkgrQeYUiOqeJyDCB5YVYtt2q7+MCrw@mail.gmail.com
Whole thread Raw
In response to Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
List pgsql-hackers

On Sat, Mar 24, 2018 at 5:28 PM, Robert Haas <robertmhaas@gmail.com> wrote:

This is a patch about which multiple people have expressed concerns.
You're trying to jam a heavily redesigned version in at the last
minute without adequate review.  Please don't do that.


TBH this is not a heavily redesigned version. There were two parts to the original patch:

1. Replacing 8-byte xl_prev with 2-byte xl_walid in order to reduce the size of the WAL record header
2. Changing XLogCtlInsert.CurrBytePos to use atomic operations in order to reduce the spinlock contention.

Most people expressed concerns regarding 1, but there were none regarding 2. Now it's possible that the entire attention got diverted to 1 and nobody really studied 2 in detail. Or may be 2 is mostly non-contentious, given the results of micro benchmarks.

So what I've done in v2 is to just deal with part 2 i.e. replace access to CurrBytePos with atomic operations, based on the following suggestion by Simon.

On 2/1/18 19:21, Simon Riggs wrote:
> If we really can't persuade you of that, it doesn't sink the patch. We
> can have the WAL pointer itself - it wouldn't save space but it would
> at least alleviate the spinlock.

This gives us the same level of guarantee that xl_prev used to offer, yet help us use atomic operations. I'll be happy if we can look at that particular change and see if there are any holes there.

Thanks,
Pavan

--
 Pavan Deolasee                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] MERGE SQL Statement for PG11
Next
From: Simon Riggs
Date:
Subject: Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()