diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-10-15 22:40:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-10-15 22:40:29 +0000 |
commit | 9ffc8ed58b55cb3925bb95cc184583fcb9772013 (patch) | |
tree | 9039f51525070c611a86f03a2e85a13b24005ac3 /src/include/access/valid.h | |
parent | db9e2fd0a9144707055ed382f184f5a9c11aafff (diff) | |
download | postgresql-9ffc8ed58b55cb3925bb95cc184583fcb9772013.tar.gz postgresql-9ffc8ed58b55cb3925bb95cc184583fcb9772013.zip |
Repair possible failure to update hint bits back to disk, per
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php.
This fix is intended to be permanent: it moves the responsibility for
calling SetBufferCommitInfoNeedsSave() into the tqual.c routines,
eliminating the requirement for callers to test whether t_infomask changed.
Also, tighten validity checking on buffer IDs in bufmgr.c --- several
routines were paranoid about out-of-range shared buffer numbers but not
about out-of-range local ones, which seems a tad pointless.
Diffstat (limited to 'src/include/access/valid.h')
-rw-r--r-- | src/include/access/valid.h | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/src/include/access/valid.h b/src/include/access/valid.h index 785ae80b243..62a547a181a 100644 --- a/src/include/access/valid.h +++ b/src/include/access/valid.h @@ -7,20 +7,18 @@ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/valid.h,v 1.34 2004/08/29 04:13:04 momjian Exp $ + * $PostgreSQL: pgsql/src/include/access/valid.h,v 1.35 2004/10/15 22:40:21 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef VALID_H #define VALID_H -/* ---------------- +/* * HeapKeyTest * - * Test a heap tuple with respect to a scan key. - * ---------------- + * Test a heap tuple to see if it satisfies a scan key. */ - #define HeapKeyTest(tuple, \ tupdesc, \ nkeys, \ @@ -28,9 +26,7 @@ result) \ do \ { \ -/* We use underscores to protect the variable passed in as parameters */ \ -/* We use two underscore here because this macro is included in the \ - macro below */ \ + /* Use underscores to protect the variables passed in as parameters */ \ int __cur_nkeys = (nkeys); \ ScanKey __cur_keys = (keys); \ \ @@ -41,6 +37,12 @@ do \ bool __isnull; \ Datum __test; \ \ + if (__cur_keys->sk_flags & SK_ISNULL) \ + { \ + (result) = false; \ + break; \ + } \ + \ __atp = heap_getattr((tuple), \ __cur_keys->sk_attno, \ (tupdesc), \ @@ -48,13 +50,6 @@ do \ \ if (__isnull) \ { \ - /* XXX eventually should check if SK_ISNULL */ \ - (result) = false; \ - break; \ - } \ - \ - if (__cur_keys->sk_flags & SK_ISNULL) \ - { \ (result) = false; \ break; \ } \ @@ -70,7 +65,7 @@ do \ } \ } while (0) -/* ---------------- +/* * HeapTupleSatisfies * * res is set TRUE if the HeapTuple satisfies the timequal and keytest, @@ -83,7 +78,6 @@ do \ * least likely to fail, too. we should really add the time qual test to * the restriction and optimize it in the normal way. this has interactions * with joey's expensive function work. - * ---------------- */ #define HeapTupleSatisfies(tuple, \ relation, \ @@ -95,24 +89,13 @@ do \ res) \ do \ { \ -/* We use underscores to protect the variable passed in as parameters */ \ if ((key) != NULL) \ - HeapKeyTest(tuple, RelationGetDescr(relation), \ - (nKeys), (key), (res)); \ + HeapKeyTest(tuple, RelationGetDescr(relation), nKeys, key, res); \ else \ (res) = true; \ \ - if (res) \ - { \ - if ((relation)->rd_rel->relkind != RELKIND_UNCATALOGED) \ - { \ - uint16 _infomask = (tuple)->t_data->t_infomask; \ - \ - (res) = HeapTupleSatisfiesVisibility((tuple), (snapshot)); \ - if ((tuple)->t_data->t_infomask != _infomask) \ - SetBufferCommitInfoNeedsSave(buffer); \ - } \ - } \ + if ((res) && (relation)->rd_rel->relkind != RELKIND_UNCATALOGED) \ + (res) = HeapTupleSatisfiesVisibility(tuple, snapshot, buffer); \ } while (0) #endif /* VALID_H */ |