Re: performance bug in instrument.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: performance bug in instrument.c
Date
Msg-id 16777.1360283284@sss.pgh.pa.us
Whole thread Raw
In response to performance bug in instrument.c  (Tomas Vondra <tv@fuzzy.cz>)
List pgsql-hackers
Tomas Vondra <tv@fuzzy.cz> writes:
> There's this piece of code in InstrStartNode:

>     if (instr->need_timer && INSTR_TIME_IS_ZERO(instr->starttime))
>         INSTR_TIME_SET_CURRENT(instr->starttime);
>     else
>         elog(DEBUG2, "InstrStartNode called twice in a row");

> but it should actually be like this

>     if (instr->need_timer)
>     {
>         if (INSTR_TIME_IS_ZERO(instr->starttime))
>         INSTR_TIME_SET_CURRENT(instr->starttime);
>         else
>             elog(DEBUG2, "InstrStartNode called twice in a row");
>     }

Hm.  It's a bit annoying that we can't detect the "called twice"
condition when !need_timer, but I suppose that any such bug would be a
caller logic error that would probably not be sensitive to need_timer,
so it's likely not worth adding overhead to handle that.

A bigger question is why this is elog(DEBUG2) and not elog(ERROR).
Had it been the latter, we'd have noticed the mistake immediately.
The current choice might be masking any caller-logic errors that
exist, too.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: sepgsql and materialized views
Next
From: Josh Berkus
Date:
Subject: Re: Considering Gerrit for CFs