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

« back to all changes in this revision

Viewing changes to src/backend/access/transam/slru.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-07-29 14:47:30 UTC
  • mfrom: (1.4.4)
  • Revision ID: package-import@ubuntu.com-20140729144730-gbpktxf1uyuc90kq
Tags: 8.4.22-0ubuntu0.12.04
* New upstream bug fix release: (LP: #1348176)
  - 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/docs/current/static/release-8-4-22.html
* Drop pg_regress patch to run tests with socket in /tmp, obsolete with
  above upstream changes and not applicable any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *
16
16
 * We use a control LWLock to protect the shared data structures, plus
17
17
 * per-buffer LWLocks that synchronize I/O for each buffer.  The control lock
18
 
 * must be held to examine or modify any shared state.  A process that is
 
18
 * must be held to examine or modify any shared state.  A process that is
19
19
 * reading in or writing out a page buffer does not hold the control lock,
20
20
 * only the per-buffer lock for the buffer it is working on.
21
21
 *
34
34
 * could have happened while we didn't have the lock).
35
35
 *
36
36
 * As with the regular buffer manager, it is possible for another process
37
 
 * to re-dirty a page that is currently being written out.      This is handled
 
37
 * to re-dirty a page that is currently being written out.  This is handled
38
38
 * by re-setting the page's page_dirty flag.
39
39
 *
40
40
 *
73
73
 * segment and page numbers in SimpleLruTruncate (see PagePrecedes()).
74
74
 *
75
75
 * Note: this file currently assumes that segment file names will be four
76
 
 * hex digits.  This sets a lower bound on the segment size (64K transactions
 
76
 * hex digits.  This sets a lower bound on the segment size (64K transactions
77
77
 * for 32-bit TransactionIds).
78
78
 */
79
79
#define SLRU_PAGES_PER_SEGMENT  32
113
113
 * page_lru_count entries to be "reset" to lower values than they should have,
114
114
 * in case a process is delayed while it executes this macro.  With care in
115
115
 * SlruSelectLRUPage(), this does little harm, and in any case the absolute
116
 
 * worst possible consequence is a nonoptimal choice of page to evict.  The
 
116
 * worst possible consequence is a nonoptimal choice of page to evict.  The
117
117
 * gain from allowing concurrent reads of SLRU pages seems worth it.
118
118
 */
119
119
#define SlruRecentlyUsed(shared, slotno)        \
499
499
 *
500
500
 * NOTE: only one write attempt is made here.  Hence, it is possible that
501
501
 * the page is still dirty at exit (if someone else re-dirtied it during
502
 
 * the write).  However, we *do* attempt a fresh write even if the page
 
502
 * the write).  However, we *do* attempt a fresh write even if the page
503
503
 * is already being written; this is for checkpoints.
504
504
 *
505
505
 * Control lock must be held at entry, and will be held at exit.
597
597
         * In a crash-and-restart situation, it's possible for us to receive
598
598
         * commands to set the commit status of transactions whose bits are in
599
599
         * already-truncated segments of the commit log (see notes in
600
 
         * SlruPhysicalWritePage).      Hence, if we are InRecovery, allow the case
 
600
         * SlruPhysicalWritePage).  Hence, if we are InRecovery, allow the case
601
601
         * where the file doesn't exist, and return zeroes instead.
602
602
         */
603
603
        fd = BasicOpenFile(path, O_RDWR | PG_BINARY, S_IRUSR | S_IWUSR);
1128
1128
                /*
1129
1129
                 * Hmm, we have (or may have) I/O operations acting on the page, so
1130
1130
                 * we've got to wait for them to finish and then start again. This is
1131
 
                 * the same logic as in SlruSelectLRUPage.      (XXX if page is dirty,
 
1131
                 * the same logic as in SlruSelectLRUPage.  (XXX if page is dirty,
1132
1132
                 * wouldn't it be OK to just discard it without writing it?  For now,
1133
1133
                 * keep the logic the same as it was.)
1134
1134
                 */