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: 'PostgreSQL Hackers' <pgsql-hackers@lists.postgresql.org>
Cc: 'Julien Rouhaud' <rjuju123@gmail.com>, 'Amit Kapila' <amit.kapila16@gmail.com>
Date: 2023-04-11T10:40:54Z
Lists: pgsql-hackers
Dear hackers, My PoC does not read and copy logical mappings files to new node, but I did not analyzed in detail whether it is correct. Now I have done this and considered that they do not have to be copied because transactions which executed at the same time as rewriting are no longer decoded. How do you think? Followings my analysis. ## What is logical mappings files? Logical mappings file is used to track the system catalogs while logical decoding even if its heap file is written. Sometimes catalog heaps files are modified, or completely replaced to new files via VACUUM FULL or CLUSTER, but reorder buffer cannot not track new one as-is. Mappings files allow to do them. The file contains key-value relations for old-to-new tuples. Also, the name of files contains the LSN where the triggered event is happen. Mappings files are needed when transactions which modify catalogs are decoded. If the LSN of files are older than restart_lsn, they are no longer needed then removed. Please see CheckPointLogicalRewriteHeap(). ## Is it needed? I think this is not needed. Currently pg_upgrade dumps important information from old publisher and then execute pg_create_logical_replication_slot() on new one. Apart from pg_copy_logical_replication_slot(), retart_lsn and confirmed_flush_lsn for old slot is not taken over to the new slot. They are recalculated on new node while creating. This means that transactions which have modified catalog heaps on the old publisher are no longer decoded on new publisher. Therefore, the mappings files on old publisher are not needed for new one. 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