Re: pgsql: Add the "snapshot too old" feature

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Add the "snapshot too old" feature
Дата
Msg-id 17585.1460300802@sss.pgh.pa.us
обсуждение исходный текст
Ответ на pgsql: Add the "snapshot too old" feature  (Kevin Grittner <kgrittn@postgresql.org>)
Список pgsql-committers
Kevin Grittner <kgrittn@postgresql.org> writes:
> Add the "snapshot too old" feature

I am fairly certain that this:

    typedef struct OldSnapshotControlData *OldSnapshotControl;

    static volatile OldSnapshotControl oldSnapshotControl;

does not do what you intended.  That causes the pointer variable
to be marked volatile, not what it points to.  You need to write

    static volatile OldSnapshotControlData *oldSnapshotControl;

to cause oldSnapshotControl to be understood as a pointer to
something volatile.

I think you could lose the OldSnapshotControl typedef altogether;
it's practically unused, it's confusingly similar to the name of
the pointer variable, and if anyplace did use it (eg to declare
a local-variable copy of oldSnapshotControl) it would be wrong
because of the same misplacement of the volatile property as here.

It's possible that you could instead fix this by putting the volatile
marker inside the typedef, but I'm not enough of a C language lawyer
to be sure that that works in the way you need; and since we don't
rely on such a thing anyplace else, I would be hesitant to start here.

            regards, tom lane


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Fix possible NULL dereference in ExecAlterObjectDependsStmt
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve contrib/bloom regression test using code coverage info.