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 1nN8WY-0003vq-Ik for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Feb 2022 07:26:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nN8WW-0001dl-SE for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Feb 2022 07:26:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nN8WW-0001dc-Ga for pgsql-hackers@lists.postgresql.org; Thu, 24 Feb 2022 07:26:48 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nN8WT-0005Ve-TX for pgsql-hackers@postgresql.org; Thu, 24 Feb 2022 07:26:47 +0000 Received: by mail-pf1-x42e.google.com with SMTP id p8so1100955pfh.8 for ; Wed, 23 Feb 2022 23:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=1m/X+Max/50OHB7hGUS0FS6Sshm03v3krzn/IlQseMg=; b=ApQxq/9xrZlvhvvr08/Czp1tA3+sDBbfeq+nnuGLiuZYwu1Q0mjM+YAaUfOr8VjB1v J2r9D7pIBPmWrkIrAfGMo/NVFDajN6GJvKztlnqb242eW2ejqn7yXYy31biVhf4OWGdB Jj/YymV24bzNNPeVLGo/taSp9Ybrw+bmrXZkwx+EaYJ44zrDRs0UIRew3BRT0+hwx2ZS 2/iOnxF9SUr9VJIFsvMlFcMTsuWOCSGTH2DTUkvPA0LQxX7wDMzrKRT4FvXgD4RJDUFl 06+MfzoTbB960tmT+G/kwq0yCe0eZrOX6gmy/fiWLU0bN7xT++YXTWcyvqD4xyCS7r9f P0KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=1m/X+Max/50OHB7hGUS0FS6Sshm03v3krzn/IlQseMg=; b=fIplrfIaNuyNJDxM0yw0XEgbACTixIXkEWTO60wUQ1bD7EON6IOyw5qTmhuM6zJ5nU aNJjjE2JNwu7mFmTnQlNvGRMAeJwan9Z9lZZ6ViC14mPXrelnDbDJ/50qaEsM/Oc1RVE vy47yPNlbKchQGZjRqiDHexjEU3rYOHzNXaGDlLSqv8Ur9lk5alb9oHZ8OIxhU4BOWI2 oicm1R537anjimHUdwLbBRpvNose6hXmXDI7DHIq94ue25h1kuYS0cmfvXRk0z/tdUq0 11lyR2dXYHMeKcS46Ed4qiAUS6P2isDqBePH7N8krZuX6C/oTxnqOdx/iAY1xqQ96E8a IDzA== X-Gm-Message-State: AOAM532xbzCH/9DnOSpL2UHIduSsRIk7n6vcD/JyHd52FpbRpkH89+RL y1J8qmaVFZtIPtxEs801R9k= X-Google-Smtp-Source: ABdhPJznYsf9KFsHF0rjAogDmHrEbfvkx3Q+/7BEKU+gNn5gbf0+YEmXPJRWemNkMYe3DrB+RFZiig== X-Received: by 2002:a05:6a00:1f07:b0:4e1:3335:9dd6 with SMTP id be7-20020a056a001f0700b004e133359dd6mr1347715pfb.76.1645687604740; Wed, 23 Feb 2022 23:26:44 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id kk13sm1751768pjb.44.2022.02.23.23.26.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 23 Feb 2022 23:26:44 -0800 (PST) Date: Thu, 24 Feb 2022 16:26:42 +0900 (JST) Message-Id: <20220224.162642.47104618503429482.horikyota.ntt@gmail.com> To: simseih@amazon.com Cc: alvherre@alvh.no-ip.org, pgsql-hackers@postgresql.org Subject: Re: [BUG] Panic due to incorrect missingContrecPtr after promotion From: Kyotaro Horiguchi In-Reply-To: References: <44D259DE-7542-49C4-8A52-2AB01534DCA9@amazon.com> <202202222016.3nar64wc7xs7@alvherre.pgsql> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Wed, 23 Feb 2022 02:58:07 +0000, "Imseih (AWS), Sami" wrote in > > Ooh, nice find and diagnosys. I can confirm that the test fails as you > > described without the code fix, and doesn't fail with it. > > > I attach the same patch, with the test file put in its final place > > rather than as a patch. Due to recent xlog.c changes this need a bit of > > work to apply to back branches; I'll see about getting it in all > > branches soon. > > Thank you for reviewing! Nice catch! However, I'm not sure I like the patch. * made it through and start writing after the portion that persisted. * (It's critical to first write an OVERWRITE_CONTRECORD message, which * we'll do as soon as we're open for writing new WAL.) + * + * If the last wal record is ahead of the missing contrecord, this is a + * recently promoted primary and we should not write an overwrite + * contrecord. Before the part, the comment follows the part shown below. > * Actually, if WAL ended in an incomplete record, skip the parts that So, actually WAL did not ended in an incomplete record. I think FinishWalRecover is the last place to do that. (But it could be earlier.) regards. -- Kyotaro Horiguchi NTT Open Source Software Center