Re: Performance monitor

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Performance monitor
Дата
Msg-id 14439.984006175@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Performance monitor  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> Patch or otherwise, this approach seems totally unworkable.  A signal
>> handler cannot do I/O safely, it cannot look at shared memory safely,
>> it cannot even look at the backend's own internal state safely.  How's
>> it going to do any useful status reporting?

> Why can't we do what we do with Cancel, where we set a flag and check it
> at safe places?

There's a lot of assumptions hidden in that phrase "safe places".
I don't think that everyplace we check for Cancel is going to be safe,
for example.  Cancel is able to operate in places where the internal
state isn't completely self-consistent, because it knows we are just
going to clean up and throw away intermediate status anyhow if the
cancel occurs.

Also, if you are expecting the answers to come back in a short amount of
time, then you do have to be able to do the work in the signal handler
in cases where the backend is blocked on a lock or something like that.
So that introduces a set of issues about how you know when it's
appropriate to do that and how to be sure that the signal handler
doesn't screw things up when it tries to do the report in-line.

All in all, I do not see this as an easy task that you can whip out and
then release as a 7.1 patch without extensive testing.  And given that,
I'd rather see it done with what I consider the right long-term approach,
rather than a dead-end hack.  I think doing it in a signal handler is
ultimately going to be a dead-end hack.
        regards, tom lane


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

Предыдущее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: PostgreSQL on multi-CPU systems
Следующее
От: Bruce Momjian
Дата:
Сообщение: Performance monitor signal handler