Re: Reducing the cost of sinval messaging

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reducing the cost of sinval messaging
Date: 2014-10-27 20:27:57
Message-ID: 28309.1414441677@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Oct 27, 2014 at 3:31 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Why could we not remove the hasMessages flags again, and change the
>> unlocked test
>>
>> if (!stateP->hasMessages)
>> return 0;
>>
>> into
>>
>> if (stateP->nextMsgNum == segP->maxMsgNum &&
>> !stateP->resetState)
>> return 0;
>>
>> If we are looking at stale shared state, this test might produce a
>> false positive, but I don't see why it's any less safe than testing a
>> hasMessages boolean.

> It was discussed at the time:

> http://www.postgresql.org/message-id/CA+TgmoY3Q56ZR6i8h+iGhXCw6rCZyvdWJ3RQT=PMVev4-=+N_g@mail.gmail.com
> http://www.postgresql.org/message-id/13077.1311702188@sss.pgh.pa.us

Neither of those messages seem to me to bear on this point. AFAICS,
the unlocked hasMessages test has a race condition, which the comment
just above it argues isn't a problem in practice. What I propose above
would have an absolutely indistinguishable race condition, which again
wouldn't be a problem in practice if you believe the comment's argument.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Adam Brightwell 2014-10-27 20:33:45 Re: alter user/role CURRENT_USER
Previous Message Peter Geoghegan 2014-10-27 20:24:58 Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}