Re:Possible corruption by CreateRestartPoint at promotion

From: Rui Zhao <875941708(at)qq(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re:Possible corruption by CreateRestartPoint at promotion
Date: 2022-04-27 04:36:10
Message-ID: tencent_BAFE9CD296B6A27E8497CD86F6DAA7F43306@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kyotaro's&nbsp;patch seems good to me and fixes the test case in my patch.
Do you have interest in adding a test like one in my patch?

&gt; + LWLockAcquire(ControlFileLock, LW_EXCLUSIVE); &gt; + &gt; /* &gt; * Remember the prior checkpoint's redo ptr for &gt; * UpdateCheckPointDistanceEstimate() &gt; */ &gt; PriorRedoPtr = ControlFile-&gt;checkPointCopy.redo; &gt; &gt; + Assert (PriorRedoPtr < RedoRecPtr);Maybe PriorRedoPtr does not need to be under LWLockAcquire?
regards. -- Zhao Rui Alibaba Cloud: https://www.aliyun.com/
------------------&nbsp;Original&nbsp;------------------
From: "Kyotaro Horiguchi" <horikyota(dot)ntt(at)gmail(dot)com&gt;;
Date:&nbsp;Wed, Mar 16, 2022 09:24 AM
To:&nbsp;"pgsql-hackers"<pgsql-hackers(at)lists(dot)postgresql(dot)org&gt;;
Cc:&nbsp;"masao.fujii"<masao(dot)fujii(at)oss(dot)nttdata(dot)com&gt;;
Subject:&nbsp;Possible corruption by CreateRestartPoint at promotion

Hello,&nbsp; (Cc:ed Fujii-san)

This is a diverged topic from [1], which is summarized as $SUBJECT.

To recap:

While discussing on additional LSNs in checkpoint log message,
Fujii-san pointed out [2] that there is a case where
CreateRestartPoint leaves unrecoverable database when concurrent
promotion happens. That corruption is "fixed" by the next checkpoint
so it is not a severe corruption.

AFAICS since 9.5, no check(/restart)pionts won't run concurrently with
restartpoint [3].&nbsp; So I propose to remove the code path as attached.

regards.

[1] https://www.postgresql.org/message-id/20220316.091913.806120467943749797.horikyota.ntt%40gmail.com

[2] https://www.postgresql.org/message-id/7bfad665-db9c-0c2a-2604-9f54763c5f9e%40oss.nttdata.com

[3] https://www.postgresql.org/message-id/20220222.174401.765586897814316743.horikyota.ntt%40gmail.com

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Test-of-this-problem-v14.patch application/octet-stream 3.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-04-27 04:55:50 Re: bogus: logical replication rows/cols combinations
Previous Message Bharath Rupireddy 2022-04-27 03:27:23 Re: pgsql: Add contrib/pg_walinspect.