|
65 | 65 | #include"access/relscan.h"
|
66 | 66 | #include"access/transam.h"
|
67 | 67 | #include"access/xact.h"
|
| 68 | +#include"catalog/index.h" |
68 | 69 | #include"pgstat.h"
|
69 | 70 | #include"storage/bufmgr.h"
|
70 | 71 | #include"storage/lmgr.h"
|
|
76 | 77 |
|
77 | 78 | /* ----------------------------------------------------------------
|
78 | 79 | *macros used in index_ routines
|
| 80 | + * |
| 81 | + * Note: the ReindexIsProcessingIndex() check in RELATION_CHECKS is there |
| 82 | + * to check that we don't try to scan or do retail insertions into an index |
| 83 | + * that is currently being rebuilt or pending rebuild. This helps to catch |
| 84 | + * things that don't work when reindexing system catalogs. The assertion |
| 85 | + * doesn't prevent the actual rebuild because we don't use RELATION_CHECKS |
| 86 | + * when calling the index AM's ambuild routine, and there is no reason for |
| 87 | + * ambuild to call its subsidiary routines through this file. |
79 | 88 | * ----------------------------------------------------------------
|
80 | 89 | */
|
81 | 90 | #defineRELATION_CHECKS \
|
82 | 91 | ( \
|
83 | 92 | AssertMacro(RelationIsValid(indexRelation)), \
|
84 |
| -AssertMacro(PointerIsValid(indexRelation->rd_am)) \ |
| 93 | +AssertMacro(PointerIsValid(indexRelation->rd_am)), \ |
| 94 | +AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \ |
85 | 95 | )
|
86 | 96 |
|
87 | 97 | #defineSCAN_CHECKS \
|
|