summaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/rel.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-01-31 04:35:57 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-01-31 04:35:57 +0000
commita152ebeec6142fbdaaaecd0922041b2f70745851 (patch)
tree4e2287020e98b488752cd286f212a4aab8e98a5e /src/backend/utils/cache/rel.c
parentca0f1435ecd6f273428c6eefbc37c0210daa735d (diff)
Fix problems seen in parallel regress tests when SI buffer overruns (causing
syscache and relcache flushes). Relcache entry rebuild now preserves original tupledesc, rewrite rules, and triggers if possible, so that pointers to these things remain valid --- if these things change while relcache entry has positive refcount, we elog(ERROR) to avoid later crash. Arrange for xact-local rels to be rebuilt when an SI inval message is seen for them, so that they are updated by CommandCounterIncrement the same as regular rels. (This is useful because of Hiroshi's recent changes to process our own SI messages at CommandCounterIncrement time.) This allows simplification of some routines that previously hacked around the lack of an automatic update. catcache now keeps its own copy of tupledesc for its relation, rather than depending on the relcache's copy; this avoids needing to reinitialize catcache during a cache flush, which saves some cycles and eliminates nasty circularity problems that occur if a cache flush happens while trying to initialize a catcache. Eliminate a number of permanent memory leaks that used to happen during catcache or relcache flush; not least of which was that catcache never freed any cached tuples! (Rule parsetree storage is still leaked, however; will fix that separately.) Nothing done yet about code that uses tuples retrieved by SearchSysCache for longer than is safe.
Diffstat (limited to 'src/backend/utils/cache/rel.c')
-rw-r--r--src/backend/utils/cache/rel.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/src/backend/utils/cache/rel.c b/src/backend/utils/cache/rel.c
index d24c1ca0c9c..50edb422468 100644
--- a/src/backend/utils/cache/rel.c
+++ b/src/backend/utils/cache/rel.c
@@ -8,11 +8,10 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/rel.c,v 1.7 2000/01/26 05:57:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/rel.c,v 1.8 2000/01/31 04:35:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
-/* #define RELREFDEBUG 1 */
#include "postgres.h"
#include "access/istrat.h"
@@ -21,45 +20,22 @@
/*
* RelationIsValid is now a macro in rel.h -cim 4/27/91
*
- * Many of the RelationGet...() functions are now macros in rel.h
+ * All of the RelationGet...() functions are now macros in rel.h
* -mer 3/2/92
*/
/*
- * RelationGetIndexStrategy
- * Returns index strategy for a relation.
- *
- * Note:
- * Assumes relation descriptor is valid.
- * Assumes relation descriptor is for an index relation.
- */
-IndexStrategy
-RelationGetIndexStrategy(Relation relation)
-{
- return relation->rd_istrat;
-}
-
-/*
* RelationSetIndexSupport
* Sets index strategy and support info for a relation.
*
+ * This routine saves two pointers -- one to the IndexStrategy, and
+ * one to the RegProcs that support the indexed access method.
+ *
* Note:
- * Assumes relation descriptor is a valid pointer to sufficient space.
+ * Assumes relation descriptor is valid.
* Assumes index strategy is valid. Assumes support is valid if non-
* NULL.
*/
-/* ----------------
- * RelationSetIndexSupport
- *
- * This routine saves two pointers -- one to the IndexStrategy, and
- * one to the RegProcs that support the indexed access method. These
- * pointers are stored in the space following the attribute data in the
- * reldesc.
- *
- * NEW: the index strategy and support are now stored in real fields
- * at the end of the structure - jolly
- * ----------------
- */
void
RelationSetIndexSupport(Relation relation,
IndexStrategy strategy,