pgsql: StartupXLOG: Don't repeatedly disable/enable local xlog insertio

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: StartupXLOG: Don't repeatedly disable/enable local xlog insertio
Date: 2021-10-25 14:43:27
Message-ID: E1mf1CB-0000FM-3j@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

StartupXLOG: Don't repeatedly disable/enable local xlog insertion.

All the code that runs in the startup process to write WAL records
before that's allowed generally is now consecutive, so there's no
reason to shut the facility to write WAL locally off and then turn
it on again three times in a row.

Unfortunately, this requires a slight kludge in the checkpointer,
which needs to separately enable writing WAL in order to write the
checkpoint record. Because that code might run in the same process
as StartupXLOG() if we are in single-user mode, we must save/restore
the state of the LocalXLogInsertAllowed flag. Hopefully, we'll be
able to eliminate this wart in further refactoring, but it's
not too bad anyway.

Amul Sul, with modifications by me.

Discussion: http://postgr.es/m/CAAJ_b97fysj6sRSQEfOHj-y8Jfd5uPqOgO74qast89B4WfD+TA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/18e0913a420349d373cfd8e45b91b4777501fb74

Modified Files
--------------
src/backend/access/transam/xlog.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2021-10-25 15:03:37 pgsql: Remove useless code from CreateReplicationSlot.
Previous Message Amit Kapila 2021-10-25 10:51:26 Re: pgsql: Document XLOG_INCLUDE_XID a little better