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