RE: [PoC] pg_upgrade: allow to upgrade publisher node

Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>

From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'vignesh C' <vignesh21@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Julien Rouhaud <rjuju123@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>
Date: 2023-08-02T08:13:14Z
Lists: pgsql-hackers
Dear Vignesh,

Thank you for making the PoC!

> Here is a patch which checks that there are no WAL records other than
> CHECKPOINT_SHUTDOWN WAL record to be consumed based on the discussion
> from [1].

Basically I agreed your approach. Thanks!

> Patch 0001 and 0002 is same as the patch posted by Kuroda-san, Patch
> 0003 exposes pg_get_wal_records_content to get the WAL records along
> with the WAL record type between start and end lsn. pg_walinspect
> contrib module already exposes a function for this requirement, I have
> moved this functionality to be exposed from the backend. Patch 0004
> has slight change in check function to check that there are no other
> records other than CHECKPOINT_SHUTDOWN to be consumed. The attached
> patch has the changes for the same.
> Thoughts?
> 
> [1] -
> https://www.postgresql.org/message-id/CAA4eK1Kem-J5NM7GJCgyKP84pEN6
> RsG6JWo%3D6pSn1E%2BiexL1Fw%40mail.gmail.com

Few comments:

* Per comment from Amit [1], I used pg_get_wal_record_info() instead of pg_get_wal_records_info().
This function extract a next available WAL record, which can avoid huge scan if
the confirmed_flush is much behind.
* According to cfbot and my analysis, the 0001 cannot pass the test on macOS.
 So I revived Julien's patch [2] as 0002 once. AFAIS the 0001 is not so welcomed.

Next patch will be available soon.

[1]: https://www.postgresql.org/message-id/CAA4eK1LWKkoyy-p-SAT0JTWa%3D6kXiMd%3Da6ZcArY9eU4a3g4TZg%40mail.gmail.com
[2]: https://www.postgresql.org/message-id/20230414061248.vdsxz2febjo3re6h%40jrouhaud

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Commits

  1. Fix issues in binary_upgrade_logical_slot_has_caught_up().

  2. Fix a random failure in 003_logical_slots.pl.

  3. Fix a test in 003_logical_slots.

  4. Fix uninitialized slot array access during the upgrade.

  5. Fix the test 003_logical_slots.

  6. Commit b195e6d482 forgot to update meson.build.

  7. Use shorter file names in the upgrade logical slots test.

  8. Migrate logical slots to the new node during an upgrade.

  9. Flush logical slots to disk during a shutdown checkpoint if required.

  10. Prevent possibility of panics during shutdown checkpoint.