1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Improve cache invalidation handling. Eespecially

this would fix TODO
* elog() flushes cache, try invalidating just entries from
  current xact, perhaps using invalidation cache
This commit is contained in:
Hiroshi Inoue
2000-01-10 06:30:56 +00:00
parent 5770935965
commit 0f2e7948e2
5 changed files with 476 additions and 51 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.62 1999/12/21 00:06:40 wieck Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.63 2000/01/10 06:30:50 inoue Exp $
*
*
* INTERFACE ROUTINES
@@ -1262,7 +1262,7 @@ heap_insert(Relation relation, HeapTuple tup)
RelationPutHeapTupleAtEnd(relation, tup);
if (IsSystemRelationName(RelationGetRelationName(relation)))
RelationInvalidateHeapTuple(relation, tup);
RelationMark4RollbackHeapTuple(relation, tup);
return tup->t_data->t_oid;
}
@@ -1473,6 +1473,8 @@ l2:
RelationPutHeapTupleAtEnd(relation, newtup);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
}
/* mark for rollback caches */
RelationMark4RollbackHeapTuple(relation, newtup);
/*
* New item in place, now record address of new tuple in t_ctid of old

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.57 2000/01/05 18:23:44 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.58 2000/01/10 06:30:50 inoue Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -165,6 +165,7 @@ static void AtAbort_Cache(void);
static void AtAbort_Locks(void);
static void AtAbort_Memory(void);
static void AtCommit_Cache(void);
static void AtCommit_LocalCache(void);
static void AtCommit_Locks(void);
static void AtCommit_Memory(void);
static void AtStart_Cache(void);
@@ -512,8 +513,11 @@ CommandCounterIncrement()
CurrentTransactionStateData.scanCommandId = CurrentTransactionStateData.commandId;
/* make cache changes visible to me */
AtCommit_Cache();
/*
* make cache changes visible to me. AtCommit_LocalCache()
* instead of AtCommit_Cache() is called here.
*/
AtCommit_LocalCache();
AtStart_Cache();
}
@@ -663,15 +667,26 @@ static void
AtCommit_Cache()
{
/* ----------------
* Make catalog changes visible to me for the next command.
* Other backends will not process my invalidation messages until
* after I commit and free my locks--though they will do
* unnecessary work if I abort.
* Make catalog changes visible to all backend.
* ----------------
*/
RegisterInvalid(true);
}
/* --------------------------------
* AtCommit_LocalCache
* --------------------------------
*/
static void
AtCommit_LocalCache()
{
/* ----------------
* Make catalog changes visible to me for the next command.
* ----------------
*/
ImmediateLocalInvalidation(true);
}
/* --------------------------------
* AtCommit_Locks
* --------------------------------