aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/transam/xact.c4
-rw-r--r--src/backend/utils/cache/catcache.c40
2 files changed, 36 insertions, 8 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 74ffb134b41..812e137071c 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.69 2000/07/02 02:28:38 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.70 2000/08/06 04:17:47 tgl Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -167,6 +167,7 @@
#include "utils/inval.h"
#include "utils/memutils.h"
#include "utils/portal.h"
+#include "utils/catcache.h"
#include "utils/relcache.h"
#include "utils/temprel.h"
@@ -797,6 +798,7 @@ static void
AtAbort_Cache()
{
RelationCacheAbort();
+ SystemCacheAbort();
RegisterInvalid(false);
}
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 037fe69e81d..1c0b39c84b5 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.69 2000/07/02 05:38:40 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.70 2000/08/06 04:17:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -506,6 +506,7 @@ CatalogCacheIdInvalidate(int cacheId, /* XXX */
* public functions
*
* ResetSystemCache
+ * SystemCacheAbort
* InitIndexedSysCache
* InitSysCache
* SearchSysCache
@@ -517,7 +518,7 @@ CatalogCacheIdInvalidate(int cacheId, /* XXX */
* --------------------------------
*/
void
-ResetSystemCache()
+ResetSystemCache(void)
{
CatCache *cache;
@@ -545,19 +546,44 @@ ResetSystemCache()
{
nextelt = DLGetSucc(elt);
CatCacheRemoveCTup(cache, elt);
- if (cache->cc_ntup < 0)
- elog(NOTICE,
- "ResetSystemCache: cc_ntup<0 (software error)");
}
}
- cache->cc_ntup = 0; /* in case of WARN error above */
- cache->busy = false; /* to recover from recursive-use error */
+
+ /* double-check that ntup is now zero */
+ if (cache->cc_ntup != 0)
+ {
+ elog(NOTICE,
+ "ResetSystemCache: cache %d has cc_ntup = %d, should be 0",
+ cache->id, cache->cc_ntup);
+ cache->cc_ntup = 0;
+ }
}
CACHE1_elog(DEBUG, "end of ResetSystemCache call");
}
/* --------------------------------
+ * SystemCacheAbort
+ *
+ * This routine is called to clean up catcache state as needed during
+ * transaction abort.
+ * --------------------------------
+ */
+void
+SystemCacheAbort(void)
+{
+ CatCache *cache;
+
+ /* ----------------
+ * clear the "cache busy" flags, which may have been left set if we
+ * elog'd out during a cache lookup attempt.
+ * ----------------
+ */
+ for (cache = Caches; PointerIsValid(cache); cache = cache->cc_next)
+ cache->busy = false;
+}
+
+/* --------------------------------
* SystemCacheRelationFlushed
*
* This is called by RelationFlushRelation() to clear out cached information