Re: Support reset of Shared objects statistics in "pg_stat_reset" function

Поиск
Список
Период
Сортировка
От Dilip Kumar
Тема Re: Support reset of Shared objects statistics in "pg_stat_reset" function
Дата
Msg-id CAFiTN-v559pxL=GnRVzc7RVJe=s=VBtQJfHERFrb486wBpcEwQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Support reset of Shared objects statistics in "pg_stat_reset" function  (Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com>)
Ответы Re: Support reset of Shared objects statistics in "pg_stat_reset" function  (Mahendra Singh Thalor <mahi6run@gmail.com>)
Список pgsql-hackers
On Fri, Aug 6, 2021 at 8:53 PM Himanshu Upadhyaya
<upadhyaya.himanshu@gmail.com> wrote:
>
> Hi Sadhu,
>
> Patch working as expected with shared tables, just one Minor comment on the patch.
> +       if (!dbentry)
> +               return;
> +
> +       /*
> +        * We simply throw away all the shared table entries by recreating new
> +        * hash table for them.
> +        */
> +       if (dbentry->tables != NULL)
> +               hash_destroy(dbentry->tables);
> +       if (dbentry->functions != NULL)
> +               hash_destroy(dbentry->functions);
> +
> +       dbentry->tables = NULL;
> +       dbentry->functions = NULL;
> +
> +       /*
> +        * This creates empty hash tables for tables and functions.
> +        */
> +       reset_dbentry_counters(dbentry);
>
> We already have the above code for non-shared tables, can we restrict duplicate code?
> one solution I can think of, if we can have a list with two elements and iterate each element with
> these common steps?

Another idea could be that instead of putting this logic in
pgstat_recv_resetcounter(), we can have this logic in pg_stat_reset()
or maybe in pgstat_reset_counters().  So now
pgstat_recv_resetcounter() logic remain the same and I think that
logic is much cleaner i.e. whatever dobid it got in the message it
will reset stat for that dboid.

So now, if it depends upon the logic of the callers that what they
want to do so in this case pgstat_recv_resetcounter(), can send two
messages one for MyDatabaseOid which it is already doing, and another
message for the InvalidOid.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



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

Предыдущее
От: Himanshu Upadhyaya
Дата:
Сообщение: Re: Support reset of Shared objects statistics in "pg_stat_reset" function
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: Numeric x^y for negative x