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 1lrY2t-0007gW-A0 for pgsql-general@arkaria.postgresql.org; Fri, 11 Jun 2021 03:41:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lrY2s-0004KJ-9r for pgsql-general@arkaria.postgresql.org; Fri, 11 Jun 2021 03:41:22 +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 1lrY2r-0004KB-Sm for pgsql-general@lists.postgresql.org; Fri, 11 Jun 2021 03:41:22 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lrY2p-0005Hg-PE for pgsql-general@lists.postgresql.org; Fri, 11 Jun 2021 03:41:20 +0000 Received: by mail-oi1-x230.google.com with SMTP id t40so4467272oiw.8 for ; Thu, 10 Jun 2021 20:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=5ddNSZQUPmtpCD46oc40c18QlNj7iXrH6L8pxLyeWS4=; b=Lz9xGfXGwovBGCz2z7CvYPRpbKZXCyD0U3QFcA5qilOxr6jJCxRJBp65BhArdjckCI zB1d2Y5rvI+e8eo6QF2xYQqeVy/sdVi8fUqHxg0eW7wk01RaIjiX0V23VaxEPLq7AsKV 8TmSlonjxC82kBL3rX0cgNvpeM8TQcu58YHpORMoYwpe6bN6N3RR6DF0e/+XDbSRHQZR vVxym9KY4UkmNX+hLTNr4zH5PLOeNyurkHu2/a8PwdZ6J6r99av8RGEOFkpKWj2ei1WM dO4BrD3mF+lJoGgb49COfML6Njx3rndRs4Qg8geVP2z5l/jkKcnHhhQpL4FQuSwmieK4 9I4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=5ddNSZQUPmtpCD46oc40c18QlNj7iXrH6L8pxLyeWS4=; b=AYGMC8JUZcTGU6m1A0C6cAZuvnWcFw/PrNTgKifJoWnzYFCCd9Vnmq8bWkr6fjo4dT 2t1H5Km8ATsMK2a3StYBUnfPkLCwsJFF3k04oOcCbAov6L1wwd/RUkOTSGqZ56ye2kt3 WBftkdTl2/QhN+gCL2DZ163RuYTytcWH29dhC7yvMKOZNkbpUQ/Tt2GBH4noYBCw8bI8 3hpVsciKMRllYerOTuhJmgM5qEbVXz9yvLCO1rb0/arN/Rb7L3N4zTU6FPICUhNKlJXM 56v4yQ3Z+tc3z8/p/RcrzgIRVk1rEOV2dVqso5mqa7k3rjVswD2nvDLiOrJiIPV67lIm 7rEA== X-Gm-Message-State: AOAM531tZrzBcqhguRS35XjZgGVcH0YdF/gf+W8pKdbgkbV5O+FN6qh+ 63mP51bZVx3pUDLqLFqppfitNydI/CsruA== X-Google-Smtp-Source: ABdhPJybPvf5P63eEIHsPT6TR5nYnBNjPXgg1Wyu/4TxYakEQXZI00/+gLEUCfgYk6HPgTJKv01BoA== X-Received: by 2002:a05:6808:145:: with SMTP id h5mr9682211oie.24.1623382878678; Thu, 10 Jun 2021 20:41:18 -0700 (PDT) Received: from [192.168.88.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id f2sm931557ooj.22.2021.06.10.20.41.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Jun 2021 20:41:18 -0700 (PDT) Subject: Re: Postgresql crashdown and recovery failure To: pgsql-general@lists.postgresql.org References: <2715b5290b7548a8a98d14f720008793@huawei.com> From: Ron Message-ID: Date: Thu, 10 Jun 2021 22:41:17 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <2715b5290b7548a8a98d14f720008793@huawei.com> Content-Type: multipart/alternative; boundary="------------7D41F3633974D842A526E71A" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------7D41F3633974D842A526E71A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 6/10/21 10:30 PM, xiebin (F) wrote: > > Hi, > > My database (Postgresql 12.5) server uses remote storage as data directory. > > I powered off the database server and started postgresql (same version) on > another server, with same data. However it failed. I checked wal logs and > found that the content around latest checkpoint is empty. (about 1700 zero > bytes) > [snip] > > From the output, I can see that data files, pg_control file and wal log > are flushed to disk. And I noticed that pg_control file is flushed between > 2 wal flush (as noted A,B,C). > > Here are my questions: > > 1.If power off occurs between B and C. Would it be possible that > checkpoint was written to pg_control but not to wal log? And as a > consequence, postgresql recovery would fail? > > 2.Is there any other reason causing this problem? > Is your Postgresql instance configured to use fsync? > 3.Is there any way to recover the data? I know pg_resetwal can reset wal > log, then postgresql can start. But undoubtedly it could cause some data loss. > -- Angular momentum makes the world go 'round. --------------7D41F3633974D842A526E71A Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 6/10/21 10:30 PM, xiebin (F) wrote:

Hi,

 

My database (Postgresql 12.5) server uses remote storage as data directory.

 

I powered off the database server and started postgresql (same version) on another server, with same data. However it failed. I checked wal logs and found that the content around latest checkpoint is empty. (about 1700 zero bytes)

[snip]
 

From the output, I can see that data files, pg_control file and wal log are flushed to disk. And I noticed that pg_control file is flushed between 2 wal flush (as noted A,B,C).

 

Here are my questions:

1.  If power off occurs between B and C. Would it be possible that checkpoint was written to pg_control but not to wal log? And as a consequence, postgresql recovery would fail?

2.  Is there any other reason causing this problem?


Is your Postgresql instance configured to use fsync?

3.  Is there any way to recover the data? I know pg_resetwal can reset wal log, then postgresql can start. But undoubtedly it could cause some data loss.


--
Angular momentum makes the world go 'round.
--------------7D41F3633974D842A526E71A--