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: "Wei Wang (Fujitsu)" <wangw.fnst@fujitsu.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Julien Rouhaud <rjuju123@gmail.com>, vignesh C <vignesh21@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Amit Kapila <amit.kapila16@gmail.com>, 'Peter Smith' <smithpb2250@gmail.com>
Date: 2023-05-22T10:20:31Z
Lists: pgsql-hackers
Attachments
- v15-0001-pg_upgrade-Add-include-logical-replication-slots.patch (application/octet-stream) patch v15-0001
- v15-0002-Always-persist-to-disk-logical-slots-during-a-sh.patch (application/octet-stream) patch v15-0002
- v15-0003-pg_upgrade-Add-check-function-for-include-logica.patch (application/octet-stream) patch v15-0003
- v15-0004-Change-the-method-used-to-check-logical-replicat.patch (application/octet-stream) patch v15-0004
Dear Wang,
Thank you for reviewing! PSA new version.
> For patches 0001
>
> 1. The latest patch set fails to apply because the new commit (0245f8d) in HEAD.
I didn't notice that. Thanks, fixed.
> 2. In file pg_dump.h.
> ```
> +/*
> + * The LogicalReplicationSlotInfo struct is used to represent replication
> + * slots.
> + *
> + * XXX: add more attributes if needed
> + */
> +typedef struct _LogicalReplicationSlotInfo
> +{
> + DumpableObject dobj;
> + char *plugin;
> + char *slottype;
> + bool twophase;
> +} LogicalReplicationSlotInfo;
> ```
>
> Do we need the structure member "slottype"? It seems we do not use "slottype"
> because we only dump logical replication slot.
As you said, this attribute is not needed. This is a garbage of previous efforts.
Removed.
> For patch 0002
>
> 3. In the function SaveSlotToPath
> ```
> - /* and don't do anything if there's nothing to write */
> - if (!was_dirty)
> + /*
> + * and don't do anything if there's nothing to write, unless it's this is
> + * called for a logical slot during a shutdown checkpoint, as we want to
> + * persist the confirmed_flush_lsn in that case, even if that's the only
> + * modification.
> + */
> + if (!was_dirty && !is_shutdown && !SlotIsLogical(slot))
> ```
> It seems that the code isn't consistent with our expectation.
> If this is called for a physical slot during a shutdown checkpoint and there's
> nothing to write, I think it will also persist physical slots to disk.
You meant to say that we should not change handlings for physical case, right?
> For patch 0003
>
> 4. In the function check_for_parameter_settings
> ```
> + /* --include-logical-replication-slots can be used since PG 16. */
> + if (GET_MAJOR_VERSION(new_cluster->major_version < 1600))
> + return;
> ```
> It seems that there is a slight mistake (the input of GET_MAJOR_VERSION) in the
> if-condition:
> GET_MAJOR_VERSION(new_cluster->major_version < 1600)
> ->
> GET_MAJOR_VERSION(new_cluster->major_version) <= 1500
>
> Please also check the similar if-conditions in the below two functions
> check_for_confirmed_flush_lsn (in 0003 patch)
> check_are_logical_slots_active (in 0004 patch)
Done. I grepped with GET_MAJOR_VERSION, and confirmed they were fixed.
Best Regards,
Hayato Kuroda
FUJITSU LIMITED
Commits
-
Fix issues in binary_upgrade_logical_slot_has_caught_up().
- 0bf62460bb9e 17.0 landed
-
Fix a random failure in 003_logical_slots.pl.
- 63c5df126abb 17.0 landed
-
Fix a test in 003_logical_slots.
- 3e36e48d8efe 17.0 landed
-
Fix uninitialized slot array access during the upgrade.
- a7db71ed2787 17.0 landed
-
Fix the test 003_logical_slots.
- 8af917be6bad 17.0 landed
-
Commit b195e6d482 forgot to update meson.build.
- 8949b978ff49 17.0 landed
-
Use shorter file names in the upgrade logical slots test.
- b195e6d482b8 17.0 landed
-
Migrate logical slots to the new node during an upgrade.
- 29d0a77fa660 17.0 landed
-
Flush logical slots to disk during a shutdown checkpoint if required.
- e0b2eed047df 17.0 landed
-
Prevent possibility of panics during shutdown checkpoint.
- c6c333436491 10.0 cited