Re: read transaction and sync rep

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: read transaction and sync rep
Дата
Msg-id CA+U5nMKEM_=dpgt51Z0YoyCVqHsgAb0KbFT1nmhO_=Y=pzLoRQ@mail.gmail.com
обсуждение исходный текст
Ответ на read transaction and sync rep  (Fujii Masao <masao.fujii@gmail.com>)
Ответы Re: read transaction and sync rep  (Jeff Janes <jeff.janes@gmail.com>)
Список pgsql-hackers
On Fri, Jan 13, 2012 at 11:30 AM, Fujii Masao <masao.fujii@gmail.com> wrote:

> I found that even read transaction waits for sync rep when it generates
> WAL records even if XID is not assigned. For example, imagine the case
> where SELECT query does a heap clean operation and generates
> XLOG_HEAP2_CLEAN record. ISTM that such a read transaction doesn't
> need to wait for sync rep because that's not visible to the client... Can
> we skip waiting for sync rep if XID is not assigned?

Your example of XLOG_HEAP2_CLEAN records is a good one but there are
other record types and circumstances, as described in the comment near
the top of RecordTransactionCommit
    /*     * If we didn't create XLOG entries, we're done here; otherwise we     * should flush those entries the same
asa commit record.    (An     * example of a possible record that wouldn't cause an XID to be     * assigned is a
sequenceadvance record due to nextval() --- we want     * to flush that to disk before reporting commit.)     */    if
(!wrote_xlog)       goto cleanup; 

Perhaps there is a case to say that sequences don't need to be flushed
if all they did was do nextval but no change was associated with that,
I'm not sure.

So I think there is a case for optimisation using finer grained decision making.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


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

Предыдущее
От: Fujii Masao
Дата:
Сообщение: read transaction and sync rep
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: New replication mode: write