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

« back to all changes in this revision

Viewing changes to contrib/pgstattuple/pgstattuple.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:
277
277
        BlockNumber tupblock;
278
278
        Buffer          buffer;
279
279
        pgstattuple_type stat = {0};
280
 
        BufferAccessStrategy bstrategy;
281
280
 
282
281
        /* Disable syncscan because we assume we scan from block zero upwards */
283
282
        scan = heap_beginscan_strat(rel, SnapshotAny, 0, NULL, true, false);
284
283
 
285
284
        nblocks = scan->rs_nblocks; /* # blocks to be scanned */
286
285
 
287
 
        /* prepare access strategy for this table */
288
 
        bstrategy = GetAccessStrategy(BAS_BULKREAD);
289
 
        scan->rs_strategy = bstrategy;
290
 
 
291
286
        /* scan the relation */
292
287
        while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
293
288
        {
311
306
 
312
307
                /*
313
308
                 * To avoid physically reading the table twice, try to do the
314
 
                 * free-space scan in parallel with the heap scan.      However,
 
309
                 * free-space scan in parallel with the heap scan.  However,
315
310
                 * heap_getnext may find no tuples on a given page, so we cannot
316
311
                 * simply examine the pages returned by the heap scan.
317
312
                 */
321
316
                {
322
317
                        CHECK_FOR_INTERRUPTS();
323
318
 
324
 
                        buffer = ReadBufferExtended(rel, MAIN_FORKNUM, block, RBM_NORMAL, bstrategy);
 
319
                        buffer = ReadBufferExtended(rel, MAIN_FORKNUM, block,
 
320
                                                                                RBM_NORMAL, scan->rs_strategy);
325
321
                        LockBuffer(buffer, BUFFER_LOCK_SHARE);
326
322
                        stat.free_space += PageGetHeapFreeSpace((Page) BufferGetPage(buffer));
327
323
                        UnlockReleaseBuffer(buffer);
328
324
                        block++;
329
325
                }
330
326
        }
331
 
        heap_endscan(scan);
332
327
 
333
328
        while (block < nblocks)
334
329
        {
335
330
                CHECK_FOR_INTERRUPTS();
336
331
 
337
 
                buffer = ReadBufferExtended(rel, MAIN_FORKNUM, block, RBM_NORMAL, bstrategy);
 
332
                buffer = ReadBufferExtended(rel, MAIN_FORKNUM, block,
 
333
                                                                        RBM_NORMAL, scan->rs_strategy);
338
334
                LockBuffer(buffer, BUFFER_LOCK_SHARE);
339
335
                stat.free_space += PageGetHeapFreeSpace((Page) BufferGetPage(buffer));
340
336
                UnlockReleaseBuffer(buffer);
341
337
                block++;
342
338
        }
343
339
 
 
340
        heap_endscan(scan);
344
341
        relation_close(rel, AccessShareLock);
345
342
 
346
343
        stat.table_len = (uint64) nblocks *BLCKSZ;