Re: [PoC] pg_upgrade: allow to upgrade publisher node
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
"Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, Peter Smith <smithpb2250@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Bruce Momjian <bruce@momjian.us>, Julien Rouhaud <rjuju123@gmail.com>, vignesh C <vignesh21@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>
Date: 2023-09-28T07:36:37Z
Lists: pgsql-hackers
On Thu, Sep 28, 2023 at 10:44 AM Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> wrote: > > On Mon, Sep 25, 2023 at 2:06 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > [1] https://www.postgresql.org/message-id/CAA4eK1%2BLtWDKXvxS7gnJ562VX%2Bs3C6%2B0uQWamqu%3DUuD8hMfORg%40mail.gmail.com > > > > > > I see. IIUC, without that commit e0b2eed [1], it may happen that the > > > slot's on-disk confirmed_flush LSN value can be higher than the WAL > > > LSN that's flushed to disk, no? > > > > > > > No, without that commit, there is a very high possibility that even if > > we have sent the WAL to the subscriber and got the acknowledgment of > > the same, we would miss updating it before shutdown. This would lead > > to upgrade failures because upgrades have no way to later identify > > whether the remaining WAL records are sent to the subscriber. > > Thanks for clarifying. I'm trying understand what happens without > commit e0b2eed0 with an illustration: > > step 1: publisher - confirmed_flush LSN in replication slot on disk > structure is 80 > step 2: publisher - sends WAL at LSN 100 > step 3: subscriber - acknowledges the apply LSN or confirmed_flush LSN as 100 > step 4: publisher - shuts down without writing the new confirmed_flush > LSN as 100 to disk, note that commit e0b2eed0 is not in place > step 5: publisher - restarts > step 6: subscriber - upon publisher restart, the subscriber requests > WAL from publisher from LSN 100 as it tracks the last applied LSN in > replication origin > > Now, if the pg_upgrade with the patch in this thread is run on > publisher after step 4, it complains with "The slot \"%s\" has not > consumed the WAL yet". > > Is my above understanding right? > Yes. -- With Regards, Amit Kapila.
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