Re: An unlikely() experiment

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: An unlikely() experiment
Дата
Msg-id 20160719212423.qyfrfafdiy34haui@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: An unlikely() experiment  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-hackers
On 2015-12-20 14:21:14 +1300, David Rowley wrote:
> On 20 December 2015 at 03:06, Andres Freund <andres@anarazel.de> wrote:
> > One way to do this would be to add elog_on() / ereport_on() macros,
> > directly containing the error message. Like
> > #define elog_on(cond, elevel, ...) \
> >         do { \
> >            if (unlikely(cond)) \
> >            { \
> >                 elog(elevel, __VA_ARGS__) \
> >            } \
> >         } while(0)
> >
> 
> Interesting idea. Would you think that would be something we could do a
> complete replace on, or are you thinking just for the hotter code paths?

More or less complete. Generally, logging shouldn't be a hot code
path. A single wrong branch won't be noticeable in case we're logging
something, not to speak of an actual error case.  As far as I can see
there's unfortunately no way to declare a branch unlikely from inside
that branch, otherwise I'd have said we should just stick an unlikely
equivalent in the elog/ereport definition itself.

- Andres



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

Предыдущее
От: "petrum@gmail.com"
Дата:
Сообщение: Question about an inconsistency - 3
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Document that vacuum can't truncate if old_snapshot_threshold >= 0