Re: Get rid of WALBufMappingLock - Mailing list pgsql-hackers

From Andrey Borodin
Subject Re: Get rid of WALBufMappingLock
Date
Msg-id C27929F1-4932-42A1-8B9B-EACBEEBDB0EB@yandex-team.ru
Whole thread Raw
In response to Re: Get rid of WALBufMappingLock  (Alexander Korotkov <aekorotkov@gmail.com>)
List pgsql-hackers

> On 25 Feb 2025, at 20:19, Alexander Korotkov <aekorotkov@gmail.com> wrote:
>
>


Hi!

One little piece of code looks suspicious to me. But I was not raising concern because I see similar code everywhere in
thecodebase. But know Kirill asked to me explain what is going on and I cannot. 

This seems to be relevant… so.

+    while (upto >= pg_atomic_read_u64(&XLogCtl->InitializedUpTo))
   // Assume ConditionVariableBroadcast() happened here, but before next line
+        ConditionVariableSleep(&XLogCtl->InitializedUpToCondVar, WAIT_EVENT_WAL_BUFFER_INIT);
+    ConditionVariableCancelSleep();

Won’t this sleep wait forever?

I see about 20 other occurrences of similar code, so, perhaps, everything is fine. But I would greatly appreciate a
littlepointers on why it works. 


Best regards, Andrey Borodin.


pgsql-hackers by date:

Previous
From: Jakub Wartak
Date:
Subject: Re: Draft for basic NUMA observability
Next
From: Amit Kapila
Date:
Subject: Re: Adding a '--two-phase' option to 'pg_createsubscriber' utility.