Re: POC: Cache data in GetSnapshotData()

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: POC: Cache data in GetSnapshotData()
Дата
Msg-id 20160104085845.m5nrypvmmpea5nm7@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: POC: Cache data in GetSnapshotData()  (Mithun Cy <mithun.cy@enterprisedb.com>)
Список pgsql-hackers
On 2015-12-19 22:47:30 -0800, Mithun Cy wrote:
> After some analysis I saw writing to shared memory to store shared snapshot
> is not protected under exclusive write lock, this leads to memory
> corruptions.
> I think until this is fixed measuring the performance will not be much
> useful.

I think at the very least the cache should be protected by a separate
lock, and that lock should be acquired with TryLock. I.e. the cache is
updated opportunistically. I'd go for an lwlock in the first iteration.

If that works nicely we can try to keep several 'snapshot slots' around,
and only lock one of them exclusively. With some care users of cached
snapshots can copy the snapshot, while another slot is updated in
parallel. But that's definitely not step 1.

Greetings,

Andres Freund



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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: WIP: Covering + unique indexes.
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Multi-tenancy with RLS