~ubuntu-branches/ubuntu/trusty/postgresql-9.3/trusty-proposed

« back to all changes in this revision

Viewing changes to src/bin/pg_dump/pg_backup_archiver.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-07-24 16:13:59 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20140724161359-uk325qfv03euxuuh
Tags: 9.3.5-0ubuntu0.14.04.1
* New upstream bug fix release: (LP: #1348176)
  - pg_upgrade: Users who upgraded to version 9.3 using pg_upgrade may have
    an issue with transaction information which causes VACUUM to eventually
    fail. These users should run the script provided in the release notes to
    determine if their installation is affected, and then take the remedy
    steps outlined there.
  - Various data integrity and other bug fixes.
  - Secure Unix-domain sockets of temporary postmasters started during make
    check.
    Any local user able to access the socket file could connect as the
    server's bootstrap superuser, then proceed to execute arbitrary code as
    the operating-system user running the test, as we previously noted in
    CVE-2014-0067. This change defends against that risk by placing the
    server's socket in a temporary, mode 0700 subdirectory of /tmp.
  - See release notes for details:
    http://www.postgresql.org/about/news/1534/
* Remove pg_regress patches to support --host=/path, obsolete with above
  upstream changes and not applicable any more.
* Drop tcl8.6 patch, applied upstream.
* Add missing logrotate test dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
627
627
 
628
628
                                        _selectOutputSchema(AH, "pg_catalog");
629
629
 
 
630
                                        /* Send BLOB COMMENTS data to ExecuteSimpleCommands() */
 
631
                                        if (strcmp(te->desc, "BLOB COMMENTS") == 0)
 
632
                                                AH->outputKind = OUTPUT_OTHERDATA;
 
633
 
630
634
                                        (*AH->PrintTocDataPtr) (AH, te, ropt);
 
635
 
 
636
                                        AH->outputKind = OUTPUT_SQLCMDS;
631
637
                                }
632
638
                                else
633
639
                                {
643
649
                                        /*
644
650
                                         * In parallel restore, if we created the table earlier in
645
651
                                         * the run then we wrap the COPY in a transaction and
646
 
                                         * precede it with a TRUNCATE.  If archiving is not on
647
 
                                         * this prevents WAL-logging the COPY.  This obtains a
 
652
                                         * precede it with a TRUNCATE.  If archiving is not on
 
653
                                         * this prevents WAL-logging the COPY.  This obtains a
648
654
                                         * speedup similar to that from using single_txn mode in
649
655
                                         * non-parallel restores.
650
656
                                         */
1555
1561
 * items.
1556
1562
 *
1557
1563
 * The arrays are indexed by dump ID (so entry zero is unused).  Note that the
1558
 
 * array entries run only up to maxDumpId.      We might see dependency dump IDs
 
1564
 * array entries run only up to maxDumpId.  We might see dependency dump IDs
1559
1565
 * beyond that (if the dump was partial); so always check the array bound
1560
1566
 * before trying to touch an array entry.
1561
1567
 */
1579
1585
 
1580
1586
                /*
1581
1587
                 * tableDataId provides the TABLE DATA item's dump ID for each TABLE
1582
 
                 * TOC entry that has a DATA item.      We compute this by reversing the
 
1588
                 * TOC entry that has a DATA item.  We compute this by reversing the
1583
1589
                 * TABLE DATA item's dependency, knowing that a TABLE DATA item has
1584
1590
                 * just one dependency and it is the TABLE item.
1585
1591
                 */
2618
2624
        appendPQExpBuffer(cmd, "SET SESSION AUTHORIZATION ");
2619
2625
 
2620
2626
        /*
2621
 
         * SQL requires a string literal here.  Might as well be correct.
 
2627
         * SQL requires a string literal here.  Might as well be correct.
2622
2628
         */
2623
2629
        if (user && *user)
2624
2630
                appendStringLiteralAHX(cmd, user, AH);
2749
2755
}
2750
2756
 
2751
2757
/*
2752
 
 * Become the owner of the given TOC entry object.      If
 
2758
 * Become the owner of the given TOC entry object.  If
2753
2759
 * changes in ownership are not allowed, this doesn't do anything.
2754
2760
 */
2755
2761
static void
3242
3248
        /*
3243
3249
         * If we haven't already read the header, do so.
3244
3250
         *
3245
 
         * NB: this code must agree with _discoverArchiveFormat().      Maybe find a
 
3251
         * NB: this code must agree with _discoverArchiveFormat().  Maybe find a
3246
3252
         * way to unify the cases?
3247
3253
         */
3248
3254
        if (!AH->readHeader)
3353
3359
                return false;
3354
3360
 
3355
3361
        /*
3356
 
         * Check that fseeko(SEEK_SET) works, too.      NB: we used to try to test
 
3362
         * Check that fseeko(SEEK_SET) works, too.  NB: we used to try to test
3357
3363
         * this with fseeko(fp, 0, SEEK_CUR).  But some platforms treat that as a
3358
3364
         * successful no-op even on files that are otherwise unseekable.
3359
3365
         */
3393
3399
 *
3394
3400
 * Work is done in three phases.
3395
3401
 * First we process all SECTION_PRE_DATA tocEntries, in a single connection,
3396
 
 * just as for a standard restore.      Second we process the remaining non-ACL
 
3402
 * just as for a standard restore.  Second we process the remaining non-ACL
3397
3403
 * steps in parallel worker children (threads on Windows, processes on Unix),
3398
3404
 * each of which connects separately to the database.  Finally we process all
3399
3405
 * the ACL entries in a single connection (that happens back in
3415
3421
         * Do all the early stuff in a single connection in the parent. There's no
3416
3422
         * great point in running it in parallel, in fact it will actually run
3417
3423
         * faster in a single connection because we avoid all the connection and
3418
 
         * setup overhead.      Also, pre-9.2 pg_dump versions were not very good
 
3424
         * setup overhead.  Also, pre-9.2 pg_dump versions were not very good
3419
3425
         * about showing all the dependencies of SECTION_PRE_DATA items, so we do
3420
3426
         * not risk trying to process them out-of-order.
3421
3427
         *
3461
3467
        }
3462
3468
 
3463
3469
        /*
3464
 
         * Now close parent connection in prep for parallel steps.      We do this
 
3470
         * Now close parent connection in prep for parallel steps.  We do this
3465
3471
         * mainly to ensure that we don't exceed the specified number of parallel
3466
3472
         * connections.
3467
3473
         */
3506
3512
 
3507
3513
        /*
3508
3514
         * Initialize the lists of ready items, the list for pending items has
3509
 
         * already been initialized in the caller.      After this setup, the pending
 
3515
         * already been initialized in the caller.  After this setup, the pending
3510
3516
         * list is everything that needs to be done but is blocked by one or more
3511
3517
         * dependencies, while the ready list contains items that have no
3512
3518
         * remaining dependencies. Note: we don't yet filter out entries that