Re: FOR [SHARE|UPDATE] NOWAIT may still block in EvalPlanQualFetch

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: FOR [SHARE|UPDATE] NOWAIT may still block in EvalPlanQualFetch
Дата
Msg-id 20140827232224.GL7046@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на FOR [SHARE|UPDATE] NOWAIT may still block in EvalPlanQualFetch  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-hackers
Craig Ringer wrote:
> FOR SHARE|UPDATE NOWAIT will still block if they have to follow a ctid
> chain because the call to EvalPlanQualFetch doesn't take a param for
> noWait, so it doesn't know not to block if the updated row can't be locked.

Applied with some further editorialization.


In another thread, I wrote in response to Thomas Munro:

> I tried Craig's patch with your test case and found that it stalls in
> XactLockTableWait inside EPQFetch because it doesn't throw an error in
> the noWait case before waiting.  I think I will fix that and push,
> including both test cases.

Done.  I also made the noWait case try a ConditionalXactLockTableWait
before raising an error, because there's a small chance that the
updating transaction aborts just before we check; in this case there is
no need to raise an error.

> I am wondering about backpatching Craig's fix.  It looks to me like it
> should be backpatched as far back as NOWAIT exists, but that was in 8.1
> and we haven't ever gotten a complaint until Craig's report AFAIK, which
> I understand wasn't coming from a user finding a problem but rather some
> new development.  So I hesitate.

On further reflection, the reason users don't complain is that it's
quite difficult to notice that there is an issue.  And on the other
hand, since they are already specifying NOWAIT in the query, surely they
must already be expecting an error to be raised; it's not like this
introduces a new failure mode.  My inclination would be to backpatch the
fix all the way back.

However, due to time constraints (because it fails to apply cleanly
to older branches) and due to lack of user complaints, I only
backpatched to 9.4.  We can always revisit that, if there's demand.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Missing plpgsql.o Symbols on OS X
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: SKIP LOCKED DATA (work in progress)