diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-05-14 22:52:41 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-05-14 22:52:49 -0400 |
commit | 5d00b764cd682f6071b35033f508a431d9d3f920 (patch) | |
tree | 5d7b273dbb651f0a2a94491e9c9432e4c171a6c9 /src/backend/executor | |
parent | b91e5b4684d840c903a78e86700b9d906033c2ad (diff) | |
download | postgresql-5d00b764cd682f6071b35033f508a431d9d3f920.tar.gz postgresql-5d00b764cd682f6071b35033f508a431d9d3f920.zip |
Make pgstat tabstat lookup hash table less fragile.
Code review for commit 090010f2e.
Fix cases where an elog(ERROR) partway through a function would leave the
persistent data structures in a corrupt state. pgstat_report_stat got this
wrong by invalidating PgStat_TableEntry structs before removing hashtable
entries pointing to them, and get_tabstat_entry got it wrong by ignoring
the possibility of palloc failure after it had already created a hashtable
entry.
Also, avoid leaking a memory context per transaction, which the previous
code did through misunderstanding hash_create's API. We do not need to
create a context to hold the hash table; hash_create will do that.
(The leak wasn't that large, amounting to only a memory context header
per iteration, but it's still surprising that nobody noticed it yet.)
Diffstat (limited to 'src/backend/executor')
0 files changed, 0 insertions, 0 deletions