TAP PostgresNode function to gdb stacks and optional cores for all backends

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема TAP PostgresNode function to gdb stacks and optional cores for all backends
Дата
Msg-id CAGRY4nz6a_ooOJTEMo0GeGCvkCwKq0HuMqMdq7pwq8-Ad4Eh2g@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Hi all

I recently wrote a utility that adds a $node->gdb_backends() method to PostgresNode instances - figured I'd share it here in case anyone finds it useful, or wants to adopt it into the features of the TAP tools.

This function provides a one-line way to dump stacks for all running backends to per-pid files or to the main test log, as well as the values of various global variables that are potentially of interest. A default set of globals will be dumped for each backend and the caller can specify additional expressions of interest.

If requested, cores will be dumped for each running backend.

A subset of backends may be passed by pid instead, so you can easily target specific backends you're interested in.

I initially wrote this to help debug a variety of issues with shutdown, where I hacked the PostgresNode stop() method to trap failed shutdowns and report stacks for all surviving processes + the postmaster in my wrapper class for PostgresNode:

sub stop {
    my ($self, $mode) = @_;
    local($@);
    eval {
        PostgresNode::stop($self, $mode);
    };
    if ($@) {
        $node->gdb_backends(want_cores => 1);
        die $@;
    }
}
Вложения

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Logical decoding without slots: decoding in lockstep with recovery
Следующее
От: "k.jamison@fujitsu.com"
Дата:
Сообщение: RE: [Patch] Optimize dropping of relation buffers using dlist