Turn off zero_damaged_pages in the right place (ie, in the autovac
authorTom Lane
Tue, 7 Mar 2006 17:32:22 +0000 (17:32 +0000)
committerTom Lane
Tue, 7 Mar 2006 17:32:22 +0000 (17:32 +0000)
process not in the postmaster) and with the right GucSource (needs to
be a nontransactional source since we've not started an xact yet).

src/backend/postmaster/autovacuum.c

index 76295f47dd289d4ad64214b964a8a54beb9aa6c9..d98f47f9b73f93bd2f519bb8c8a852ada539ff95 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.14 2006/03/07 03:03:09 momjian Exp $
+ *   $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.15 2006/03/07 17:32:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -125,9 +125,6 @@ autovac_start(void)
    if (!AutoVacuumingActive())
        return 0;
 
-   /* Even if zero_damaged_pages is true, we don't want autovacuum zeroing. */
-   SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_SESSION);
-
    /*
     * Do nothing if too soon since last autovacuum exit.  This limits how
     * often the daemon runs.  Since the time per iteration can be quite
@@ -307,6 +304,13 @@ AutoVacMain(int argc, char *argv[])
 
    PG_SETMASK(&UnBlockSig);
 
+   /*
+    * Force zero_damaged_pages OFF in the autovac process, even if it is
+    * set in postgresql.conf.  We don't really want such a dangerous option
+    * being applied non-interactively.
+    */
+   SetConfigOption("zero_damaged_pages", "false", PGC_SUSET, PGC_S_OVERRIDE);
+
    /* Get a list of databases */
    dblist = autovac_get_database_list();