mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.42 1999/08/12 00:42:43 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.43 1999/09/24 00:24:23 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -125,14 +125,14 @@ IndexNext(IndexScan *node)
|
||||
{
|
||||
int iptr;
|
||||
|
||||
slot->ttc_buffer = InvalidBuffer;
|
||||
slot->ttc_shouldFree = false;
|
||||
ExecClearTuple(slot);
|
||||
if (estate->es_evTupleNull[node->scan.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->scan.scanrelid - 1];
|
||||
slot->ttc_shouldFree = false;
|
||||
|
||||
for (iptr = 0; iptr < numIndices; iptr++)
|
||||
{
|
||||
scanstate->cstate.cs_ExprContext->ecxt_scantuple = slot;
|
||||
@ -142,6 +142,7 @@ IndexNext(IndexScan *node)
|
||||
}
|
||||
if (iptr == numIndices) /* would not be returned by indices */
|
||||
slot->val = NULL;
|
||||
|
||||
/* Flag for the next call that no more tuples */
|
||||
estate->es_evTupleNull[node->scan.scanrelid - 1] = true;
|
||||
return (slot);
|
||||
@ -192,7 +193,7 @@ IndexNext(IndexScan *node)
|
||||
* the scan state. Eventually we will only do this and not
|
||||
* return a tuple. Note: we pass 'false' because tuples
|
||||
* returned by amgetnext are pointers onto disk pages and
|
||||
* were not created with palloc() and so should not be pfree()'d.
|
||||
* must not be pfree()'d.
|
||||
* ----------------
|
||||
*/
|
||||
ExecStoreTuple(tuple, /* tuple to store */
|
||||
@ -200,6 +201,13 @@ IndexNext(IndexScan *node)
|
||||
buffer, /* buffer associated with tuple */
|
||||
false); /* don't pfree */
|
||||
|
||||
/*
|
||||
* At this point we have an extra pin on the buffer,
|
||||
* because ExecStoreTuple incremented the pin count.
|
||||
* Drop our local pin.
|
||||
*/
|
||||
ReleaseBuffer(buffer);
|
||||
|
||||
/*
|
||||
* We must check to see if the current tuple would have
|
||||
* been matched by an earlier index, so we don't double
|
||||
@ -223,8 +231,6 @@ IndexNext(IndexScan *node)
|
||||
else
|
||||
ExecClearTuple(slot);
|
||||
}
|
||||
if (BufferIsValid(buffer))
|
||||
ReleaseBuffer(buffer);
|
||||
}
|
||||
if (indexNumber < numIndices)
|
||||
{
|
||||
|
Reference in New Issue
Block a user