diff options
Diffstat (limited to 'src/backend/utils/init/miscinit.c')
-rw-r--r-- | src/backend/utils/init/miscinit.c | 59 |
1 files changed, 55 insertions, 4 deletions
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index 9f19d1187ba..22baac3706f 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.113 2003/08/04 04:03:10 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.114 2003/09/24 18:54:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -51,6 +51,11 @@ static char socketLockFile[MAXPGPATH]; /* ---------------------------------------------------------------- * ignoring system indexes support stuff + * + * NOTE: "ignoring system indexes" means we do not use the system indexes + * for lookups (either in hardwired catalog accesses or in planner-generated + * plans). We do, however, still update the indexes when a catalog + * modification is made. * ---------------------------------------------------------------- */ @@ -61,15 +66,14 @@ static bool isIgnoringSystemIndexes = false; * True if ignoring system indexes. */ bool -IsIgnoringSystemIndexes() +IsIgnoringSystemIndexes(void) { return isIgnoringSystemIndexes; } /* * IgnoreSystemIndexes - * Set true or false whether PostgreSQL ignores system indexes. - * + * Set true or false whether PostgreSQL ignores system indexes. */ void IgnoreSystemIndexes(bool mode) @@ -78,6 +82,53 @@ IgnoreSystemIndexes(bool mode) } /* ---------------------------------------------------------------- + * system index reindexing support + * + * When we are busy reindexing a system index, this code provides support + * for preventing catalog lookups from using that index. + * ---------------------------------------------------------------- + */ + +static Oid currentlyReindexedHeap = InvalidOid; +static Oid currentlyReindexedIndex = InvalidOid; + +/* + * ReindexIsProcessingHeap + * True if heap specified by OID is currently being reindexed. + */ +bool +ReindexIsProcessingHeap(Oid heapOid) +{ + return heapOid == currentlyReindexedHeap; +} + +/* + * ReindexIsProcessingIndex + * True if index specified by OID is currently being reindexed. + */ +bool +ReindexIsProcessingIndex(Oid indexOid) +{ + return indexOid == currentlyReindexedIndex; +} + +/* + * SetReindexProcessing + * Set flag that specified heap/index are being reindexed. + * Pass InvalidOid to indicate that reindexing is not active. + */ +void +SetReindexProcessing(Oid heapOid, Oid indexOid) +{ + /* Args should be both, or neither, InvalidOid */ + Assert((heapOid == InvalidOid) == (indexOid == InvalidOid)); + /* Reindexing is not re-entrant. */ + Assert(indexOid == InvalidOid || currentlyReindexedIndex == InvalidOid); + currentlyReindexedHeap = heapOid; + currentlyReindexedIndex = indexOid; +} + +/* ---------------------------------------------------------------- * database path / name support stuff * ---------------------------------------------------------------- */ |