~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-proposed

« back to all changes in this revision

Viewing changes to src/backend/postmaster/autovacuum.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-09-06 14:11:13 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090906141113-qf5f3hkw7n036jfy
Tags: 8.4.1-1
* Urgency medium due to security fix.
* New upstream security/bug fix release:
  - Disallow "RESET ROLE" and "RESET SESSION AUTHORIZATION" inside
    security-definer functions. This covers a case that was missed in the
    previous patch that disallowed "SET ROLE" and "SET SESSION
    AUTHORIZATION" inside security-definer functions. [CVE-2007-6600]
  - Fix WAL page header initialization at the end of archive recovery.
    This could lead to failure to process the WAL in a subsequent archive
    recovery.
  - Fix "cannot make new WAL entries during recovery" error.
  - Fix problem that could make expired rows visible after a crash.
    This bug involved a page status bit potentially not being set
    correctly after a server crash.
  - Make "LOAD" of an already-loaded loadable module into a no-op.
    Formerly, "LOAD" would attempt to unload and re-load the module,
    but this is unsafe and not all that useful.
  - Make window function PARTITION BY and ORDER BY items always be
    interpreted as simple expressions.
    In 8.4.0 these lists were parsed following the rules used for
    top-level GROUP BY and ORDER BY lists. But this was not correct per
    the SQL standard, and it led to possible circularity.
  - Fix several errors in planning of semi-joins. These led to wrong query
    results in some cases where IN or EXISTS was used together with another
    join.
  - Fix handling of whole-row references to subqueries that are within
    an outer join. An example is SELECT COUNT(ss.-) FROM ... LEFT JOIN
    (SELECT ...) ss ON .... Here, ss.- would be treated as
    ROW(NULL,NULL,...) for null-extended join rows, which is not the same as
    a simple NULL.  Now it is treated as a simple NULL.
  - Fix locale handling with plperl. This bug could cause the server's
    locale setting to change when a plperl function is called, leading to
    data corruption.
  - Fix handling of reloptions to ensure setting one option doesn't
    force default values for others.
  - Ensure that a "fast shutdown" request will forcibly terminate open
    sessions, even if a "smart shutdown" was already in progress.
  - Avoid memory leak for array_agg() in GROUP BY queries.
  - Treat to_char(..., 'TH') as an uppercase ordinal suffix with
    'HH'/'HH12'.  It was previously handled as 'th'.
  - Include the fractional part in the result of EXTRACT(second) and
    EXTRACT(milliseconds) for time and time with time zone inputs.
    This has always worked for floating-point datetime configurations,
    but was broken in the integer datetime code.
  - Fix overflow for INTERVAL 'x ms' when "x" is more than 2 million
    and integer datetimes are in use.
  - Improve performance when processing toasted values in index scans.
    This is particularly useful for PostGIS.
  - Fix a typo that disabled commit_delay.
  - Output early-startup messages to "postmaster.log" if the server is
    started in silent mode. Previously such error messages were discarded,
    leading to difficulty in debugging.
  - Remove translated FAQs. They are now on the wiki. The main FAQ was moved
    to the wiki some time ago.
  - Fix pg_ctl to not go into an infinite loop if "postgresql.conf" is
    empty.
  - Fix several errors in pg_dump's --binary-upgrade mode. pg_dump
    --binary-upgrade is used by pg_migrator.
  - Fix "contrib/xml2"'s xslt_process() to properly handle the maximum
    number of parameters (twenty).
  - Improve robustness of libpq's code to recover from errors during
    "COPY FROM STDIN".
  - Avoid including conflicting readline and editline header files when
    both libraries are installed.
  - Work around gcc bug that causes "floating-point exception" instead
    of "division by zero" on some platforms.
* debian/control: Bump Standards-Version to 3.8.3 (no changes necessary).

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
 *
56
56
 *
57
57
 * IDENTIFICATION
58
 
 *        $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.99 2009/06/12 16:17:29 tgl Exp $
 
58
 *        $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.99.2.2 2009/08/27 17:19:31 alvherre Exp $
59
59
 *
60
60
 *-------------------------------------------------------------------------
61
61
 */
653
653
                                 * of a worker will continue to fail in the same way.
654
654
                                 */
655
655
                                AutoVacuumShmem->av_signal[AutoVacForkFailed] = false;
656
 
                                pg_usleep(100000L);             /* 100ms */
 
656
                                pg_usleep(1000000L);            /* 1s */
657
657
                                SendPostmasterSignal(PMSIGNAL_START_AUTOVAC_WORKER);
658
658
                                continue;
659
659
                        }
2449
2449
                 * toast table, try the main table too.  Otherwise use the GUC
2450
2450
                 * defaults, autovacuum's own first and plain vacuum second.
2451
2451
                 */
2452
 
                if (avopts)
2453
 
                {
2454
 
                        vac_cost_delay = avopts->vacuum_cost_delay;
2455
 
                        vac_cost_limit = avopts->vacuum_cost_limit;
2456
 
                        freeze_min_age = avopts->freeze_min_age;
2457
 
                        freeze_table_age = avopts->freeze_table_age;
2458
 
                }
2459
 
                else
2460
 
                {
2461
 
                        /* -1 in autovac setting means use plain vacuum_cost_delay */
2462
 
                        vac_cost_delay = autovacuum_vac_cost_delay >= 0 ?
2463
 
                                autovacuum_vac_cost_delay : VacuumCostDelay;
2464
 
                        /* 0 or -1 in autovac setting means use plain vacuum_cost_limit */
2465
 
                        vac_cost_limit = autovacuum_vac_cost_limit > 0 ?
2466
 
                                autovacuum_vac_cost_limit : VacuumCostLimit;
2467
 
                        /* these do not have autovacuum-specific settings */
2468
 
                        freeze_min_age = default_freeze_min_age;
2469
 
                        freeze_table_age = default_freeze_table_age;
2470
 
                }
 
2452
 
 
2453
                /* -1 in autovac setting means use plain vacuum_cost_delay */
 
2454
                vac_cost_delay = (avopts && avopts->vacuum_cost_delay >= 0)
 
2455
                        ? avopts->vacuum_cost_delay
 
2456
                        : (autovacuum_vac_cost_delay >= 0)
 
2457
                                ? autovacuum_vac_cost_delay
 
2458
                                : VacuumCostDelay;
 
2459
 
 
2460
                /* 0 or -1 in autovac setting means use plain vacuum_cost_limit */
 
2461
                vac_cost_limit = (avopts && avopts->vacuum_cost_limit > 0)
 
2462
                        ? avopts->vacuum_cost_limit
 
2463
                        : (autovacuum_vac_cost_limit > 0)
 
2464
                                ? autovacuum_vac_cost_limit
 
2465
                                : VacuumCostLimit;
 
2466
 
 
2467
                /* these do not have autovacuum-specific settings */
 
2468
                freeze_min_age = (avopts && avopts->freeze_min_age >= 0)
 
2469
                        ? avopts->freeze_min_age
 
2470
                        : default_freeze_min_age;
 
2471
 
 
2472
                freeze_table_age = (avopts && avopts->freeze_table_age >= 0)
 
2473
                        ? avopts->freeze_table_age
 
2474
                        : default_freeze_table_age;
2471
2475
 
2472
2476
                tab = palloc(sizeof(autovac_table));
2473
2477
                tab->at_relid = relid;
2564
2568
         * sources: the passed reloptions (which could be a main table or a toast
2565
2569
         * table), or the autovacuum GUC variables.
2566
2570
         */
2567
 
        if (relopts)
2568
 
        {
2569
 
                vac_scale_factor = relopts->vacuum_scale_factor;
2570
 
                vac_base_thresh = relopts->vacuum_threshold;
2571
 
                anl_scale_factor = relopts->analyze_scale_factor;
2572
 
                anl_base_thresh = relopts->analyze_threshold;
2573
 
                freeze_max_age = Min(relopts->freeze_max_age,
2574
 
                                                         autovacuum_freeze_max_age);
2575
 
                av_enabled = relopts->enabled;
2576
 
        }
2577
 
        else
2578
 
        {
2579
 
                vac_scale_factor = autovacuum_vac_scale;
2580
 
                vac_base_thresh = autovacuum_vac_thresh;
2581
 
                anl_scale_factor = autovacuum_anl_scale;
2582
 
                anl_base_thresh = autovacuum_anl_thresh;
2583
 
                freeze_max_age = autovacuum_freeze_max_age;
2584
 
                av_enabled = true;
2585
 
        }
 
2571
 
 
2572
        /* -1 in autovac setting means use plain vacuum_cost_delay */
 
2573
        vac_scale_factor = (relopts && relopts->vacuum_scale_factor >= 0)
 
2574
                ? relopts->vacuum_scale_factor
 
2575
                : autovacuum_vac_scale;
 
2576
 
 
2577
        vac_base_thresh = (relopts && relopts->vacuum_threshold >= 0)
 
2578
                ? relopts->vacuum_threshold
 
2579
                : autovacuum_vac_thresh;
 
2580
 
 
2581
        anl_scale_factor = (relopts && relopts->analyze_scale_factor >= 0)
 
2582
                ? relopts->analyze_scale_factor
 
2583
                : autovacuum_anl_scale;
 
2584
 
 
2585
        anl_base_thresh = (relopts && relopts->analyze_threshold >= 0)
 
2586
                ? relopts->analyze_threshold
 
2587
                : autovacuum_anl_thresh;
 
2588
 
 
2589
        freeze_max_age = (relopts && relopts->freeze_max_age >= 0)
 
2590
                ? Min(relopts->freeze_max_age, autovacuum_freeze_max_age)
 
2591
                : autovacuum_freeze_max_age;
 
2592
 
 
2593
        av_enabled = (relopts ? relopts->enabled : true);
2586
2594
 
2587
2595
        /* Force vacuum if table is at risk of wraparound */
2588
2596
        xidForceLimit = recentXid - freeze_max_age;