Re: \watch 0 or \watch 0.00001 doesn't do what I want - Mailing list pgsql-hackers

From Tom Lane
Subject Re: \watch 0 or \watch 0.00001 doesn't do what I want
Date
Msg-id 2423966.1728486183@sss.pgh.pa.us
Whole thread Raw
In response to Re: \watch 0 or \watch 0.00001 doesn't do what I want  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> This issue is present on newer versions still.

Here's the problem:

    long        sleep_ms = (long) (sleep * 1000);

If "sleep" is less than 0.0005, sleep_ms rounds to zero, which
results in the subsequent setitimer disarming rather than
arming the interrupt.

There is an uncommented

        if (sleep == 0)
            continue;

in the loop, which I bet some cowboy added to fix the zero-wait
problem you complained of.  But it's doing the wrong thing because
it checks sleep not sleep_ms.

We should change this to test sleep_ms, and we should probably
fix the code that says what the wait interval is to print
sleep_ms/1000.0 not sleep.  And some more comments would be good.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Zhang Mingli
Date:
Subject: Re: Use MAX_PARALLEL_WORKER_LIMIT consistently in guc_tables.c
Next
From: Alexander Kuznetsov
Date:
Subject: Re: [PATCH] Check for TupleTableSlot nullness before dereferencing