"=?ISO-8859-1?B?WmhhbyBSdWk=?=" <875941708@qq.com> writes:
> Newly promoted primary may leave an invalid checkpoint.
> In function CreateRestartPoint, control file is updated and old wals are removed. But in some situations, control
fileis not updated, old wals are still removed. Thus produces an invalid checkpoint with nonexistent wal. Crucial log:
"invalidprimary checkpoint record", "could not locate a valid checkpoint record".
I believe this is the same issue being discussed here:
https://www.postgresql.org/message-id/flat/20220316.102444.2193181487576617583.horikyota.ntt%40gmail.com
but Horiguchi-san's proposed fix looks quite different from yours.
regards, tom lane