Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njRPG-0000df-0J for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Apr 2022 20:03:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1njROF-00079M-31 for pgsql-bugs@arkaria.postgresql.org; Tue, 26 Apr 2022 20:02:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njPjn-0000Ef-D5 for pgsql-bugs@lists.postgresql.org; Tue, 26 Apr 2022 18:16:35 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1njPjk-0005vD-M6 for pgsql-bugs@lists.postgresql.org; Tue, 26 Apr 2022 18:16:35 +0000 Received: by mail-pl1-x634.google.com with SMTP id h12so27279418plf.12 for ; Tue, 26 Apr 2022 11:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AbePaXDwgI1bPwU3a+6bd5jbQCvH3R3aWQ/5qJ+oUOE=; b=DWWTV7i6W0kx/MoYTSqIYbnJ8XmhhgwOazHOHQop3fqgGZiJB3D3rIJQ7H6OrN4O/9 ulNt+X+jZwezOBqSSzwDFX/NwbFa+2d51m8DTEbzepIxporI1pw7FzC/Pc1IOOAy6ucb n7FsytbYNwEXED1FcIaFbkwQbgRFHoqKhVEgJuaRInLGT+iAxw27sxg5nGAziVv77b2i H/Ec23Cg9ElpQoWPeqD4F5tQ5L/kEICEAG5TNUIWt5b5RQgR1kUa55nbJ0b04FNZXHeo m2gBrrSmS7rovLqm2UT6DwocLasGEtqHwkjWwpzf+rhV36Ry3ss0Flb6aFxBNWCwwfik ERRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AbePaXDwgI1bPwU3a+6bd5jbQCvH3R3aWQ/5qJ+oUOE=; b=UUWkqIpRlAPq/NV988AHiqdt9OIa/zrT0SEW8lyNQoUuEUqs+YB6MV8YLawL+/5e4c aWv9Z8YpUNCbL5a74MPmC3Jc65e42lv0YLCiPcQSQGU374f0J9A19zEIW4GGUe4HiTwP 1szfpjoWQGausj8hwYqO0InB9tt8pUQddMeOhxqVlW4USSwqA+1ATY6v7lXavmXCuzkc /z9GZsyjti+2TAJZBvM/vlOcnTtReYImt/Ae7Pffq5NovaUr4S+bGM14tW07FU53L16E UFM+4LsW6YBqazf4MSPHHtcf1BNAYYbApc3gDZkUt02BZnhzJEZe9PJEzzSHfYCMgWtJ cOAw== X-Gm-Message-State: AOAM532+danUeC/bwN2jY8Hk0FP/U58momK8pJ3eilyGEp0X/0yd07l4 dmeOX/r7cmOMrxqJWbsHRz8= X-Google-Smtp-Source: ABdhPJyaK3ypFkyMaRGpkQDVgioEMsz0o1trg9EcsEwgXnqKLW6gnzmQ4ZZNmTAPGGWAJPM0NjXAlw== X-Received: by 2002:a17:90b:3b86:b0:1d9:d5e6:93a2 with SMTP id pc6-20020a17090b3b8600b001d9d5e693a2mr2623265pjb.186.1650996990509; Tue, 26 Apr 2022 11:16:30 -0700 (PDT) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id k198-20020a633dcf000000b003aa9116ba17sm13694976pga.35.2022.04.26.11.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 11:16:29 -0700 (PDT) Date: Tue, 26 Apr 2022 11:16:29 -0700 From: Nathan Bossart To: Zhao Rui <875941708@qq.com> Cc: PostgreSQL-development , pgsql-bugs Subject: Re: Fix primary crash continually with invalid checkpoint after promote Message-ID: <20220426181629.GA3002456@nathanxps13> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 26, 2022 at 03:16:13PM +0800, Zhao Rui wrote: > In function CreateRestartPoint, control file is updated and old wals are removed. But in some situations, control file is not updated, old wals are still removed. Thus produces an invalid checkpoint with nonexistent wal. Crucial log: "invalid primary checkpoint record", "could not locate a valid checkpoint record". I think this is the same issue tracked here: [0]. [0] https://postgr.es/m/20220316.102444.2193181487576617583.horikyota.ntt%40gmail.com -- Nathan Bossart Amazon Web Services: https://aws.amazon.com