Re: [Patch] ALTER SYSTEM READ ONLY
Amul Sul <sulamul@gmail.com>
Attachments
- v15-0001-Implement-wal-prohibit-state-using-global-barrie.patch (application/x-patch) patch v15-0001
- v15-0003-WIP-Documentation.patch (application/x-patch) patch v15-0003
- v15-0002-Error-or-Assert-before-START_CRIT_SECTION-for-WA.patch (application/x-patch) patch v15-0002
On Wed, Feb 17, 2021 at 7:50 AM Andres Freund <andres@anarazel.de> wrote: > On 2021-02-16 17:11:06 -0500, Robert Haas wrote: Thank you very much to both of you ! > > I can't promise that what I'm about to write is an entirely faithful > > representation of what he said, but hopefully it's not so far off that > > he gets mad at me or something. > > Seems accurate - and also I'm way too tired that I'd be mad ;) > > > > 1. If the server starts up and is read-only and > > ArchiveRecoveryRequested, clear the read-only state in memory and also > > in the control file, log a message saying that this has been done, and > > proceed. This makes some other cases simpler to deal with. > > It seems also to make sense from a behaviour POV to me: Imagine a > "smooth" planned failover with ASRO: > 1) ASRO on primary > 2) promote standby > 3) edit primary config to include primary_conninfo, add standby.signal > 4) restart "read only primary" > > There's not really any spot in which it'd be useful to do disable ASRO, > right? But 4) should make the node a normal standby. > Understood. In the attached version I have made the changes accordingly what Robert has summarised in his previous mail[1]. In addition to that, I also move the code that updates the control file to XLogAcceptWrites() which will also get skipped when the system is read-only (wal prohibited). The system will be in the crash recovery, and that will change once we do the end-of-recovery checkpoint and the WAL writes operation which we were skipping from startup. The benefit of keeping the system in recovery mode is that it fixes my concern[2] where other backends could connect and write wal records while we were changing the system to read-write. Now, no other backends allow a wal write; UpdateFullPageWrites(), end-of-recovery checkpoint, and XLogReportParameters() operations will be performed in the same sequence as it is in the startup while changing the system to read-write. Regards, Amul 1] http://postgr.es/m/CA+TgmoZ=CCTbAXxMTYZoGXEgqzOz9smkBWrDpsacpjvFcGCuaw@mail.gmail.com 2] http://postgr.es/m/CAAJ_b97xX-nqRyM_uXzecpH9aSgoMROrDNhrg1N51fDCDwoy2g@mail.gmail.com
Commits
-
Initialize variable to placate compiler.
- a030a0c5ccb1 15.0 landed
-
StartupXLOG: Don't repeatedly disable/enable local xlog insertion.
- 18e0913a4203 15.0 landed
-
StartupXLOG: Call CleanupAfterArchiveRecovery after XLogReportParameters.
- a75dbf7f9ee6 15.0 landed
-
Postpone some end-of-recovery operations related to allowing WAL.
- 811051c2e7af 15.0 landed
-
Refactor some end-of-recovery code out of StartupXLOG().
- 6df1543abfed 15.0 landed
-
Re-enable contrib/bloom's TAP tests.
- 7d1aa6bf1c27 15.0 cited
-
Remove unnecessary call to ReadCheckpointRecord().
- 1d919de5eb3f 15.0 cited
-
Allow for error or refusal while absorbing a ProcSignalBarrier.
- a3ed4d1efe9f 14.0 landed
-
Add comment to explain an unused function parameter
- 101f903e51f5 14.0 cited
-
Extend the ProcSignal mechanism to support barriers.
- 16a4e4aecd47 13.0 cited
-
At promotion, don't leave behind a partial segment on the old timeline.
- 7cbee7c0a1db 9.5.0 cited