Re: Fix archive restore race that could unlink WAL before rename - Mailing list pgsql-hackers

From Neil Chen
Subject Re: Fix archive restore race that could unlink WAL before rename
Date
Msg-id CAA3qoJnKn3-dWydK6hXOO45BMKgiBvansxaniVug1krOWZyM1w@mail.gmail.com
Whole thread
Responses Re: Improving the names generated for indexes on expressions
Re: Improving the names generated for indexes on expressions
List pgsql-hackers
Hi Stepan,

Thanks for the v2 patch. I tested it locally and also instrumented XLogSendPhysical() to 
verify the walsender behavior.

In the current test, both SendRqsPtr and sentPtr are 0/00D00000. Consequently, the walsender returnes at:

  if (SendRqstPtr <= sentPtr)
  {
      WalSndCaughtUp = true;
      return;
  }

It never reaches WalSndSegmentOpen() and therefore does not attempt to open the WAL segment involved in the race.

I also reintroduced the old unlink() behavior. The file-existence assertion failed as expected, but the standby walsender still started successfully
and did not report a missing WAL segment.

Therefore, the test does verify that the segment remains present before the rename, but the walsender portion does not currently exercise the
reported race. It may be better either to remove that portion or arrange for SendRqstPtr > sentPtr so the walsender actually attempts to read the
segment.

Regards,

--
Ze Chen (Neil)
HighGo Software Co., Ltd.
https://www.highgo.com/

pgsql-hackers by date:

Previous
From: Mark Atwood
Date:
Subject: [PATCH v1 2/3] Fetch digests explicitly for cryptohash with OpenSSL 3.0 and later
Next
From: Peter Smith
Date:
Subject: DOCS - ALTER PUBLICATION - description has confusing slash-list