Re: [Patch] ALTER SYSTEM READ ONLY
Amul Sul <sulamul@gmail.com>
Attachments
- v23-0001-Implement-wal-prohibit-state-using-global-barrie.patch (application/x-patch) patch v23-0001
- v23-0002-Error-or-Assert-before-START_CRIT_SECTION-for-WA.patch (application/x-patch) patch v23-0002
- v23-0003-Documentation.patch (application/x-patch) patch v23-0003
Attached is the rebase version for the latest master head(commit # 9f6f1f9b8e6). Regards, Amul On Mon, Mar 22, 2021 at 12:13 PM Amul Sul <sulamul@gmail.com> wrote: > > On Fri, Mar 19, 2021 at 7:17 PM Prabhat Sahu > <prabhat.sahu@enterprisedb.com> wrote: > > > > Hi all, > > While testing this feature with v20-patch, the server is crashing with below steps. > > > > Steps to reproduce: > > 1. Configure master-slave replication setup. > > 2. Connect to Slave. > > 3. Execute below statements, it will crash the server: > > SELECT pg_prohibit_wal(true); > > SELECT pg_prohibit_wal(false); > > > > -- Slave: > > postgres=# select pg_is_in_recovery(); > > pg_is_in_recovery > > ------------------- > > t > > (1 row) > > > > postgres=# SELECT pg_prohibit_wal(true); > > pg_prohibit_wal > > ----------------- > > > > (1 row) > > > > postgres=# SELECT pg_prohibit_wal(false); > > WARNING: terminating connection because of crash of another server process > > DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory. > > HINT: In a moment you should be able to reconnect to the database and repeat your command. > > server closed the connection unexpectedly > > This probably means the server terminated abnormally > > before or while processing the request. > > The connection to the server was lost. Attempting reset: Failed. > > !?> > > Thanks Prabhat. > > The assertion failure is due to wrong assumptions for the flag that were used > for the XLogAcceptWrites() call. In the case of standby, the startup process > never reached the place where it could call XLogAcceptWrites() and update the > respective flag. Due to this flag value, pg_prohibit_wal() function does > alter system state in recovery state which is incorrect. > > In the attached function I took enum value for that flag so that > pg_prohibit_wal() is only allowed in the recovery mode, iff that flag indicates > that XLogAcceptWrites() has been skipped previously. > > Regards, > Amul
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