diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-08-12 18:24:03 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-08-12 18:24:03 +0000 |
commit | 355e7ef476cf39b563713f7ec9e0c89a96dccb0d (patch) | |
tree | 60feb6c2829f1c391900cf73c554c3d354d79939 | |
parent | 0a427ab0722fa7d04cec2216b2afab3d5c09116e (diff) | |
download | postgresql-355e7ef476cf39b563713f7ec9e0c89a96dccb0d.tar.gz postgresql-355e7ef476cf39b563713f7ec9e0c89a96dccb0d.zip |
Fix old bug in log_autovacuum_min_duration code: it was relying on being able
to access a Relation entry it had just closed. I happened to be testing with
CLOBBER_CACHE_ALWAYS, which made this a guaranteed core dump (at least on
machines where sprintf %s isn't forgiving of a NULL pointer). It's probably
quite unlikely that it would fail in the field, but a bug is a bug. Fix by
moving the relation_close call down past the logging action.
-rw-r--r-- | src/backend/commands/analyze.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index e1e3498c7c6..f442bf65360 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.114.2.2 2009/05/19 08:30:12 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.114.2.3 2009/08/12 18:24:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -467,14 +467,6 @@ cleanup: /* Done with indexes */ vac_close_indexes(nindexes, Irel, NoLock); - /* - * Close source relation now, but keep lock so that no one deletes it - * before we commit. (If someone did, they'd fail to clean up the entries - * we made in pg_statistic. Also, releasing the lock before commit would - * expose us to concurrent-update failures in update_attstats.) - */ - relation_close(onerel, NoLock); - /* Log the action if appropriate */ if (IsAutoVacuumWorkerProcess() && Log_autovacuum_min_duration >= 0) { @@ -490,6 +482,14 @@ cleanup: } /* + * Close source relation now, but keep lock so that no one deletes it + * before we commit. (If someone did, they'd fail to clean up the entries + * we made in pg_statistic. Also, releasing the lock before commit would + * expose us to concurrent-update failures in update_attstats.) + */ + relation_close(onerel, NoLock); + + /* * Reset my PGPROC flag. Note: we need this here, and not in vacuum_rel, * because the vacuum flag is cleared by the end-of-xact code. */ |