Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita1f0c9b

Browse files
committed
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 withCLOBBER_CACHE_ALWAYS, which made this a guaranteed core dump (at least onmachines where sprintf %s isn't forgiving of a NULL pointer). It's probablyquite unlikely that it would fail in the field, but a bug is a bug. Fix bymoving the relation_close call down past the logging action.
1 parent9d98486 commita1f0c9b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

‎src/backend/commands/analyze.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.140 2009/08/02 22:14:52 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.141 2009/08/12 18:23:49 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -518,14 +518,6 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
518518
/* Done with indexes */
519519
vac_close_indexes(nindexes,Irel,NoLock);
520520

521-
/*
522-
* Close source relation now, but keep lock so that no one deletes it
523-
* before we commit. (If someone did, they'd fail to clean up the entries
524-
* we made in pg_statistic. Also, releasing the lock before commit would
525-
* expose us to concurrent-update failures in update_attstats.)
526-
*/
527-
relation_close(onerel,NoLock);
528-
529521
/* Log the action if appropriate */
530522
if (IsAutoVacuumWorkerProcess()&&Log_autovacuum_min_duration >=0)
531523
{
@@ -540,6 +532,14 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
540532
pg_rusage_show(&ru0))));
541533
}
542534

535+
/*
536+
* Close source relation now, but keep lock so that no one deletes it
537+
* before we commit. (If someone did, they'd fail to clean up the entries
538+
* we made in pg_statistic. Also, releasing the lock before commit would
539+
* expose us to concurrent-update failures in update_attstats.)
540+
*/
541+
relation_close(onerel,NoLock);
542+
543543
/*
544544
* Reset my PGPROC flag. Note: we need this here, and not in vacuum_rel,
545545
* because the vacuum flag is cleared by the end-of-xact code.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp