Re: Query on pg_stat_activity table got stuck

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query on pg_stat_activity table got stuck
Дата
Msg-id 30687.1557432052@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Query on pg_stat_activity table got stuck  (Jeremy Schneider <schnjere@amazon.com>)
Ответы Re: Query on pg_stat_activity table got stuck  (neeraj kumar <neeru.cse@gmail.com>)
Re: Query on pg_stat_activity table got stuck  (neeraj kumar <neeru.cse@gmail.com>)
Список pgsql-admin
Jeremy Schneider <schnjere@amazon.com> writes:
> Seems to me that at a minimum, this loop shouldn't go on forever. Even
> having an arbitrary, crazy high, hard-coded number of attempts before
> failure (like a million) would be better than spinning on the CPU
> forever - which is what we are seeing.

I don't think it's the readers' fault.  The problem is that the
writer is violating the protocol.  If we put an upper limit on
the number of spin cycles on the reader side, we'll just be creating
a new failure mode when a writer gets swapped out at the wrong moment.

IMO we need to (a) get the failure-prone code out of the critical
section, and then (b) fix the pgstat_increment_changecount macros
so that the critical sections around these shmem changes really are
critical sections (ie bump CritSectionCount).  That way, if somebody
makes the same mistake again, at least there'll be a pretty obvious
failure rather than a lot of stuck readers.

            regards, tom lane



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

Предыдущее
От: Jeremy Schneider
Дата:
Сообщение: Re: Query on pg_stat_activity table got stuck
Следующее
От: neeraj kumar
Дата:
Сообщение: Re: Query on pg_stat_activity table got stuck