Re: ERRCODE_T_R_DEADLOCK_DETECTED

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: ERRCODE_T_R_DEADLOCK_DETECTED
Дата
Msg-id 648070815.508448.1426769409322.JavaMail.yahoo@mail.yahoo.com
обсуждение исходный текст
Ответ на ERRCODE_T_R_DEADLOCK_DETECTED  (Tatsuo Ishii <ishii@postgresql.org>)
Ответы Re: ERRCODE_T_R_DEADLOCK_DETECTED  (Andres Freund <andres@2ndquadrant.com>)
Re: ERRCODE_T_R_DEADLOCK_DETECTED  (Tatsuo Ishii <ishii@postgresql.org>)
Список pgsql-hackers
Tatsuo Ishii <ishii@postgresql.org> wrote:

>     ereport(ERROR,
>             (errcode(ERRCODE_T_R_DEADLOCK_DETECTED),
>             errmsg("canceling statement due to conflict with recovery"),
>       errdetail("User transaction caused buffer deadlock with recovery.")));
>
>     ereport(ERROR,
>             (errcode(ERRCODE_T_R_DEADLOCK_DETECTED),
>             errmsg("deadlock detected"),
>             errdetail_internal("%s", clientbuf.data),
>             errdetail_log("%s", logbuf.data),
>             errhint("See server log for query details.")));
>
> The latter is a normal deadlock and can be obseved by stats
> because pgstat_report_deadlock() is called.
>
> The former is using the same error code but the meaning is pretty
> different and users might be confused IMO.
>
> I am not sure sharing the same error code is the best idea here.

That SQLSTATE value is intended to be used where the transaction
has failed because it was run concurrently with some other
transaction, rather than before or after it; and it is intended to
suggest that the transaction may succeed if run after the competing
transaction has completed.  If those apply, it seems like the right
SQLSTATE.  A user can certainly distinguish between the conditions
by looking at the error messages.

For me the big question is whether software written to retry a
transaction from the beginning when it gets this SQLSTATE would be
doing something dumb to retry transactions (perhaps after a brief
delay) for the conflict with recovery.  If using the same automated
recovery techniques is sane, then IMO it makes sense to use the
same SQLSTATE.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Variable referencing itself in example of pgbench.sgml
Следующее
От: Andres Freund
Дата:
Сообщение: Re: ERRCODE_T_R_DEADLOCK_DETECTED