On 2015-12-20 14:21:14 +1300, David Rowley wrote:
> On 20 December 2015 at 03:06, Andres Freund <and...@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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to