Re: Function to know last log write timestamp

Поиск
Список
Период
Сортировка
От Fujii Masao
Тема Re: Function to know last log write timestamp
Дата
Msg-id CAHGQGwE7mXUxoqbiK4fQV=NQ4Kf8pEMz4VTwqOoqtdpdXmB_Xw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Function to know last log write timestamp  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Function to know last log write timestamp  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Fri, Aug 15, 2014 at 1:55 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Mon, Aug 11, 2014 at 3:20 AM, Fujii Masao <masao.fujii@gmail.com> wrote:
>> There is no extra spinlock.
>
> The version I reviewed had one; that's what I was objecting to.

Sorry for confusing you. I posted the latest patch to other thread.
This version doesn't use any spinlock.

http://www.postgresql.org/message-id/CAHGQGwEwuh5CC3ib6wd0fxs9LAWme=kO09S4MOXnYnAfn7N5Bg@mail.gmail.com

> Might need to add some pg_read_barrier() and pg_write_barrier() calls,
> since we have those now.

Yep, memory barries might be needed as follows.

* Set the commit timestamp to shared memory.

shmem->counter++;
pg_write_barrier();
shmem->timestamp = my_timestamp;
pg_write_barrier();
shmem->count++;

* Read the commit timestamp from shared memory

my_count = shmem->counter;
pg_read_barrier();
my_timestamp = shmem->timestamp;
pg_read_barrier();
my_count = shmem->counter;

Is this way to use memory barriers right?

Regards,

-- 
Fujii Masao



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: B-Tree support function number 3 (strxfrm() optimization)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: jsonb format is pessimal for toast compression