diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-10-21 13:26:40 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-10-21 13:26:40 -0400 |
commit | c8e8b5a6e20bf471d83059aebe64bca16f184057 (patch) | |
tree | 2c346104aa4579489126b5eceee07080aafda017 /src/include/pgstat.h | |
parent | 980261929f2b8c40d6be1979ff81c943cad907b3 (diff) | |
download | postgresql-c8e8b5a6e20bf471d83059aebe64bca16f184057.tar.gz postgresql-c8e8b5a6e20bf471d83059aebe64bca16f184057.zip |
Try to log current the query string when a backend crashes.
To avoid minimize risk inside the postmaster, we subject this feature
to a number of significant limitations. We very much wish to avoid
doing any complex processing inside the postmaster, due to the
posssibility that the crashed backend has completely corrupted shared
memory. To that end, no encoding conversion is done; instead, we just
replace anything that doesn't look like an ASCII character with a
question mark. We limit the amount of data copied to 1024 characters,
and carefully sanity check the source of that data. While these
restrictions would doubtless be unacceptable in a general-purpose
logging facility, even this limited facility seems like an improvement
over the status quo ante.
Marti Raudsepp, reviewed by PDXPUG and myself
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r-- | src/include/pgstat.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 20c4d4354e9..d0f1927efb2 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -720,6 +720,8 @@ extern void pgstat_report_appname(const char *appname); extern void pgstat_report_xact_timestamp(TimestampTz tstamp); extern void pgstat_report_waiting(bool waiting); extern const char *pgstat_get_backend_current_activity(int pid, bool checkUser); +extern const char *pgstat_get_crashed_backend_activity(int pid, char *buffer, + int len); extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id); extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id); |