Re: [PATCH] lock_timeout and common SIGALRM framework

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] lock_timeout and common SIGALRM framework
Дата
Msg-id 26321.1342216171@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] lock_timeout and common SIGALRM framework  (Boszormenyi Zoltan <zb@cybertec.at>)
Список pgsql-hackers
Boszormenyi Zoltan <zb@cybertec.at> writes:
> It means that StatementTimeout losts its precision. It would trigger
> in the future counting from "now" instead of counting from
> GetCurrentStatementStartTimestamp().

That is, in fact, better not worse.  Note the comment in the existing
code:
        * Begin statement-level timeout        *        * Note that we compute statement_fin_time with reference to the
      * statement_timestamp, but apply the specified delay without any        * correction; that is, we ignore whatever
timehas elapsed since        * statement_timestamp was set.  In the normal case only a small        * interval will
haveelapsed and so this doesn't matter, but there        * are corner cases (involving multi-statement query strings
with       * embedded COMMIT or ROLLBACK) where we might re-initialize the        * statement timeout long after
initialreceipt of the message. In        * such cases the enforcement of the statement timeout will be a bit        *
inconsistent. This annoyance is judged not worth the cost of        * performing an additional gettimeofday() here.
 

That is, measuring from GetCurrentStatementStartTimestamp is a hack to
save one gettimeofday call, at the cost of making the timeout less
accurate, sometimes significantly so.  In the new model there isn't any
good way to duplicate this kluge (in particular, there's no point in
using enable_timeout_at, because that will still make a gettimeofday
call).  That doesn't bother me too much.  I'd rather try to buy back
whatever performance was lost by seeing if we can reduce the number of
setitimer calls.
        regards, tom lane


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

Предыдущее
От: Jeff Davis
Дата:
Сообщение: Re: initdb and fsync
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] lock_timeout and common SIGALRM framework