pgsql: Limit the verbosity of memory context statistics dumps.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Limit the verbosity of memory context statistics dumps.
Date: 2015-08-25 17:09:54
Message-ID: E1ZUHjO-00009F-CW@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Limit the verbosity of memory context statistics dumps.

We had a report from Stefan Kaltenbrunner of a case in which postmaster
log files overran available disk space because multiple backends spewed
enormous context stats dumps upon hitting an out-of-memory condition.
Given the lack of similar reports, this isn't a common problem, but it
still seems worth doing something about. However, we don't want to just
blindly truncate the output, because that might prevent diagnosis of OOM
problems. What seems like a workable compromise is to limit the dump to
100 child contexts per parent, and summarize the space used within any
additional child contexts. That should help because practical cases where
the dump gets long will typically be huge numbers of siblings under the
same parent context; while the additional debugging value from seeing
details about individual siblings beyond 100 will not be large, we hope.
Anyway it doesn't take much code or memory space to do this, so let's try
it like this and see how things go.

Since the summarization mechanism requires passing totals back up anyway,
I took the opportunity to add a "grand total" line to the end of the
printout.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7b5ef8f2d070c075811ec04a0fcb745d67c7fe3f

Modified Files
--------------
src/backend/utils/mmgr/aset.c | 42 ++++++++++++-----
src/backend/utils/mmgr/mcxt.c | 99 +++++++++++++++++++++++++++++++++++++----
src/include/nodes/memnodes.h | 21 ++++++++-
src/include/utils/memutils.h | 1 +
4 files changed, 142 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-08-25 18:06:22 pgsql: Further tweak wording of error messages about bad CONTINUE/EXIT
Previous Message Tom Lane 2015-08-25 15:43:46 pgsql: Fix potential platform dependence in gist regression test.