diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-03 17:47:56 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-03-03 17:47:56 +0000 |
commit | 26ac2171735f288a1380e173ffbb6af1a50183d8 (patch) | |
tree | e2604a289c8065884497475e46b1b2731b867267 /src/backend/commands | |
parent | 592caa089756d1b9ddf2675e9027d0c8635a6918 (diff) |
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.
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/vacuum.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index a88ce7099ec..afcdac7fb56 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.215 2002/03/02 21:39:23 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.216 2002/03/03 17:47:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -527,7 +527,7 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples, * no flush will occur, but no great harm is done since there are no * noncritical state updates here.) */ - RelationInvalidateHeapTuple(rd, &rtup); + CacheInvalidateHeapTuple(rd, &rtup); /* Write the buffer */ WriteBuffer(buffer); @@ -583,7 +583,7 @@ vac_update_dbstats(Oid dbid, dbform->datfrozenxid = frozenXID; /* invalidate the tuple in the cache and write the buffer */ - RelationInvalidateHeapTuple(relation, tuple); + CacheInvalidateHeapTuple(relation, tuple); WriteNoReleaseBuffer(scan->rs_cbuf); heap_endscan(scan); @@ -1796,7 +1796,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, */ heap_copytuple_with_tuple(&tuple, &newtup); - RelationInvalidateHeapTuple(onerel, &tuple); + /* + * register invalidation of source tuple in catcaches. + */ + CacheInvalidateHeapTuple(onerel, &tuple); /* NO ELOG(ERROR) TILL CHANGES ARE LOGGED */ START_CRIT_SECTION(); @@ -1953,7 +1956,15 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, /* copy tuple */ heap_copytuple_with_tuple(&tuple, &newtup); - RelationInvalidateHeapTuple(onerel, &tuple); + /* + * register invalidation of source tuple in catcaches. + * + * (Note: we do not need to register the copied tuple, + * because we are not changing the tuple contents and + * so there cannot be any need to flush negative + * catcache entries.) + */ + CacheInvalidateHeapTuple(onerel, &tuple); /* NO ELOG(ERROR) TILL CHANGES ARE LOGGED */ START_CRIT_SECTION(); |