1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-23 03:21:12 +03:00

Catcaches can now store negative entries as well as positive ones, to

speed up repetitive failed searches; per pghackers discussion in late
January.  inval.c logic substantially simplified, since we can now treat
inserts and deletes alike as far as inval events are concerned.  Some
repair work needed in heap_create_with_catalog, which turns out to have
been doing CommandCounterIncrement at a point where the new relation has
non-self-consistent catalog entries.  With the new inval code, that
resulted in assert failures during a relcache entry rebuild.
This commit is contained in:
Tom Lane
2002-03-03 17:47:56 +00:00
parent 592caa0897
commit 26ac217173
10 changed files with 830 additions and 595 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.130 2002/03/02 21:39:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.131 2002/03/03 17:47:53 tgl Exp $
*
*
* INTERFACE ROUTINES
@ -1131,12 +1131,12 @@ heap_insert(Relation relation, HeapTuple tup)
WriteBuffer(buffer);
/*
* If tuple is cachable, mark it for rollback from the caches in case
* If tuple is cachable, mark it for invalidation from the caches in case
* we abort. Note it is OK to do this after WriteBuffer releases the
* buffer, because the "tup" data structure is all in local memory,
* not in the shared buffer.
*/
RelationMark4RollbackHeapTuple(relation, tup);
CacheInvalidateHeapTuple(relation, tup);
return tup->t_data->t_oid;
}
@ -1278,7 +1278,7 @@ l1:
* look at the contents of the tuple, so we need to hold our refcount
* on the buffer.
*/
RelationInvalidateHeapTuple(relation, &tp);
CacheInvalidateHeapTuple(relation, &tp);
WriteBuffer(buffer);
@ -1585,19 +1585,19 @@ l2:
* boundary. We have to do this before WriteBuffer because we need to
* look at the contents of the tuple, so we need to hold our refcount.
*/
RelationInvalidateHeapTuple(relation, &oldtup);
CacheInvalidateHeapTuple(relation, &oldtup);
if (newbuf != buffer)
WriteBuffer(newbuf);
WriteBuffer(buffer);
/*
* If new tuple is cachable, mark it for rollback from the caches in
* If new tuple is cachable, mark it for invalidation from the caches in
* case we abort. Note it is OK to do this after WriteBuffer releases
* the buffer, because the "newtup" data structure is all in local
* memory, not in the shared buffer.
*/
RelationMark4RollbackHeapTuple(relation, newtup);
CacheInvalidateHeapTuple(relation, newtup);
return HeapTupleMayBeUpdated;
}