diff options
author | Tom Lane | 2009-08-12 18:23:49 +0000 |
---|---|---|
committer | Tom Lane | 2009-08-12 18:23:49 +0000 |
commit | 1820ca4b6388b9d87f5747fc5e86cfeccfb8ee16 (patch) | |
tree | 7f4b5ffa8d6d8b022120d7b7707a864a17c3b346 | |
parent | 008792365f05c1b7101222f9b8efa03f64b4021f (diff) |
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 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 5d6f32f708..71db483565 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -518,14 +518,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) { @@ -541,6 +533,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. */ |