From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> |
Subject: | Re: LogwrtResult contended spinlock |
Date: | 2024-02-16 20:54:25 |
Message-ID: | 727449f3151c6b9ab76ba706fa4d30bf7b03ad4f.camel@j-davis.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 2024-02-12 at 17:44 -0800, Jeff Davis wrote:
> It looks like there's some renewed interest in this patch:
After rebasing (attached as 0001), I'm seeing some test failures. It
looks like the local LogwrtResult is not being updated in as many
places, and that's hitting the Assert that I recently added. The fix is
easy (attached as 0002).
Though it looks like we can remove the non-shared LogwrtResult
entirely. Andres expressed some concern here:
https://www.postgresql.org/message-id/20210130020211.rtu5ir3dpjrbiats@alap3.anarazel.de
But then seemed to favor removing it here:
https://www.postgresql.org/message-id/20240213001150.4uqzh7tinuhvoopl@awork3.anarazel.de
I'm inclined to think we can get rid of the non-shared copy.
A few other comments:
* Should GetFlushRecPtr()/GetXLogWriteRecPtr() use a read memory
barrier?
* Why did you add pg_memory_barrier() right before a spinlock
acquisition?
* Is it an invariant that Write >= Flush at all times? Are there
guaranteed to be write barriers in the right place to ensure that?
I would also like it if we could add a new "Copy" pointer indicating
how much WAL data has been copied to the WAL buffers. That would be set
by WaitXLogInsertionsToFinish() so that subsequent calls are cheap.
Attached a patch (0003) for illustration purposes. It adds to the size
of XLogCtlData, but it's fairly large already, so I'm not sure if
that's a problem. If we do add this, there would be an invariant that
Copy >= Write at all times.
Regards,
Jeff Davis
Attachment | Content-Type | Size |
---|---|---|
v11j-0001-Make-XLogCtl-LogwrtResult-accessible-with-atomi.patch | text/x-patch | 12.9 KB |
v11j-0002-fixup.patch | text/x-patch | 1.2 KB |
v11j-0003-Add-WAL-Copy-pointer-representing-data-copied-t.patch | text/x-patch | 3.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2024-02-16 20:56:25 | Re: System username in pg_stat_activity |
Previous Message | Andres Freund | 2024-02-16 20:51:29 | Re: System username in pg_stat_activity |