diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-24 00:25:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-24 00:25:33 +0000 |
commit | e812458b273be00bde34fb74991ab4a99c24ab30 (patch) | |
tree | e7460ae5c0344782f6f6068399f6f7eab5be96f6 /src/backend/executor/nodeSeqscan.c | |
parent | ad791c1d140af97d93ee98883e2c45413d6f9836 (diff) | |
download | postgresql-e812458b273be00bde34fb74991ab4a99c24ab30.tar.gz postgresql-e812458b273be00bde34fb74991ab4a99c24ab30.zip |
Several changes here, not very related but touching some of the same files.
* Buffer refcount cleanup (per my "progress report" to pghackers, 9/22).
* Add links to backend PROC structs to sinval's array of per-backend info,
and use these links for routines that need to check the state of all
backends (rather than the slow, complicated search of the ShmemIndex
hashtable that was used before). Add databaseOID to PROC structs.
* Use this to implement an interlock that prevents DESTROY DATABASE of
a database containing running backends. (It's a little tricky to prevent
a concurrently-starting backend from getting in there, since the new
backend is not able to lock anything at the time it tries to look up
its database in pg_database. My solution is to recheck that the DB is
OK at the end of InitPostgres. It may not be a 100% solution, but it's
a lot better than no interlock at all...)
* In ALTER TABLE RENAME, flush buffers for the relation before doing the
rename of the physical files, to ensure we don't get failures later from
mdblindwrt().
* Update TRUNCATE patch so that it actually compiles against current
sources :-(.
You should do "make clean all" after pulling these changes.
Diffstat (limited to 'src/backend/executor/nodeSeqscan.c')
-rw-r--r-- | src/backend/executor/nodeSeqscan.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index c83aa725a70..eb73733b58f 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.20 1999/07/16 04:58:52 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.21 1999/09/24 00:24:24 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -74,20 +74,20 @@ SeqNext(SeqScan *node) if (estate->es_evTuple != NULL && estate->es_evTuple[node->scanrelid - 1] != NULL) { - slot->ttc_buffer = InvalidBuffer; - slot->ttc_shouldFree = false; + ExecClearTuple(slot); if (estate->es_evTupleNull[node->scanrelid - 1]) - { - slot->val = NULL; /* must not free tuple! */ - return (slot); - } + return slot; /* return empty slot */ + + /* probably ought to use ExecStoreTuple here... */ slot->val = estate->es_evTuple[node->scanrelid - 1]; + slot->ttc_shouldFree = false; /* * Note that unlike IndexScan, SeqScan never use keys in - * heap_beginscan (and this is very bad) - so, here we have not + * heap_beginscan (and this is very bad) - so, here we do not * check are keys ok or not. */ + /* Flag for the next call that no more tuples */ estate->es_evTupleNull[node->scanrelid - 1] = true; return (slot); @@ -104,7 +104,9 @@ SeqNext(SeqScan *node) * in our scan tuple slot and return the slot. Note: we pass 'false' * because tuples returned by heap_getnext() are pointers onto * disk pages and were not created with palloc() and so should not - * be pfree()'d. + * be pfree()'d. Note also that ExecStoreTuple will increment the + * refcount of the buffer; the refcount will not be dropped until + * the tuple table slot is cleared. * ---------------- */ @@ -114,17 +116,6 @@ SeqNext(SeqScan *node) * this tuple */ false); /* don't pfree this pointer */ - /* ---------------- - * XXX -- mao says: The sequential scan for heap relations will - * automatically unpin the buffer this tuple is on when we cross - * a page boundary. The clearslot code also does this. We bump - * the pin count on the page here, since we actually have two - * pointers to it -- one in the scan desc and one in the tuple - * table slot. --mar 20 91 - * ---------------- - */ - ExecIncrSlotBufferRefcnt(slot); - return slot; } |