Re: [Patch] ALTER SYSTEM READ ONLY

Amul Sul <sulamul@gmail.com>

From: Amul Sul <sulamul@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Andres Freund <andres@anarazel.de>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Ibrar Ahmed <ibrar.ahmad@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Prabhat Sahu <prabhat.sahu@enterprisedb.com>
Date: 2021-05-13T09:24:04Z
Lists: pgsql-hackers

Attachments

On Thu, May 13, 2021 at 12:36 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> On Wed, May 12, 2021 at 5:55 PM Amul Sul <sulamul@gmail.com> wrote:
> >
>
> Thanks for the updated patch, while going through I noticed this comment.
>
> + /*
> + * WAL prohibit state changes not allowed during recovery except the crash
> + * recovery case.
> + */
> + PreventCommandDuringRecovery("pg_prohibit_wal()");
>
> Why do we need to allow state change during recovery?  Do you still
> need it after the latest changes you discussed here, I mean now
> XLogAcceptWrites() being called before sending barrier to backends.
> So now we are not afraid that the backend will write WAL before we
> call XLogAcceptWrites().  So now IMHO, we don't need to keep the
> system in recovery until pg_prohibit_wal(false) is called, right?
>

Your understanding is correct, and the previous patch also does the same, but
the code comment is wrong.  Fixed in the attached version, also rebased for the
latest master head. Sorry for the confusion.

Regards,
Amul

Commits

  1. Initialize variable to placate compiler.

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

  3. StartupXLOG: Call CleanupAfterArchiveRecovery after XLogReportParameters.

  4. Postpone some end-of-recovery operations related to allowing WAL.

  5. Refactor some end-of-recovery code out of StartupXLOG().

  6. Re-enable contrib/bloom's TAP tests.

  7. Remove unnecessary call to ReadCheckpointRecord().

  8. Allow for error or refusal while absorbing a ProcSignalBarrier.

  9. Add comment to explain an unused function parameter

  10. Extend the ProcSignal mechanism to support barriers.

  11. At promotion, don't leave behind a partial segment on the old timeline.