Re: shared-memory based stats collector

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: shared-memory based stats collector
Дата
Msg-id 5253d750-890b-069b-031f-2a9b73e47832@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: shared-memory based stats collector  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Ответы Re: shared-memory based stats collector  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Список pgsql-hackers
Hi,

I've started looking at the patch over the past few days. I don't have 
any deep insights at this point, but there seems to be some sort of 
issue in pgstat_update_stat. When building using gcc, I do get this warning:

pgstat.c: In function ‘pgstat_update_stat’:
pgstat.c:648:18: warning: ‘now’ may be used uninitialized in this 
function [-Wmaybe-uninitialized]
    oldest_pending = now;
    ~~~~~~~~~~~~~~~^~~~~
PostgreSQL installation complete.


which kinda makes sense, because 'now' is set only in the (!force) 
branch. So if the very first call to pgstat_update_stat is with 
force=true, it's not set, and the code executes this:

     /* record oldest pending update time */
     if (pgStatPendingTabHash == NULL)
         oldest_pending = 0;
     else if (oldest_pending == 0)
         oldest_pending = now;

at which point we set "oldest_pending = now" with "now" containing some 
random garbage.

When running this under valgrind, I get a couple of warnings in this 
area of code - see the attached log with a small sample. Judging by the 
locations I assume those are related to the same issue, but I have not 
looked into that.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

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

Предыдущее
От: Mikhail Bautin
Дата:
Сообщение: Resource cleanup callbacks for foreign data wrappers
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Speeding up INSERTs and UPDATEs to partitioned tables