Re: Atomic ops for unlogged LSN
От | John Morris |
---|---|
Тема | Re: Atomic ops for unlogged LSN |
Дата | |
Msg-id | BYAPR13MB267749E1F4399B76C0939FFBA03EA@BYAPR13MB2677.namprd13.prod.outlook.com обсуждение исходный текст |
Ответ на | Re: Atomic ops for unlogged LSN (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>) |
Ответы |
Re: Atomic ops for unlogged LSN
|
Список | pgsql-hackers |
> what happens if … reader here stores the old unloggedLSN value
> to control file and the server restarts (clean exit). So, the old
>value is loaded back to unloggedLSN upon restart and the callers of
> GetFakeLSNForUnloggedRel() will see an old/repeated value too. Is it a
> problem?
First, a clarification. The value being saved is the “next” unlogged LSN,
not one which has already been used.
(we are doing “fetch and add”, not “add and fetch”)
You have a good point about shutdown and startup. It is vital we
don’t repeat an unlogged LSN. This situation could easily happen
If other readers were active while we were shutting down.
>With an atomic variable, it is guaranteed that the readers
>don't see a torn-value, but no synchronization is provided.
The atomic increment also ensures the sequence
of values is correct, specifically we don’t see
repeated values like we might with a conventional increment.
As a side effect, the instruction enforces a memory barrier, but we are not
relying on a barrier in this case.
В списке pgsql-hackers по дате отправления: