diff --git a/src/common/backend/utils/cache/partcache.cpp b/src/common/backend/utils/cache/partcache.cpp index 0c3b08cf7..52520f606 100644 --- a/src/common/backend/utils/cache/partcache.cpp +++ b/src/common/backend/utils/cache/partcache.cpp @@ -1992,6 +1992,28 @@ void PartitionSetWaitCleanGpi(Oid partOid, bool enable, bool inplace) ereport(LOG, (errmsg("partition %u set reloptions wait_clean_gpi success", partOid))); } +/* + * check one partition's invisible metadata whether need to skip the check of gpi for global index + * + * Notes: if datumPartType is 'x', that is local index of one partiiton, this case can skip the check + * of wait_clean_gpi for partition's global index + */ +bool PartitionLocalIndexSkipping(Datum datumPartType) +{ + char parttype; + + if (!PointerIsValid(datumPartType)) { + return false; + } + + parttype = DatumGetChar(datumPartType); + if (parttype == PART_OBJ_TYPE_INDEX_PARTITION) { + return false; + } + + return true; +} + /* * Check one partition's invisible metadata tuple whether still keep * diff --git a/src/gausskernel/storage/access/common/heaptuple.cpp b/src/gausskernel/storage/access/common/heaptuple.cpp index 3e8980092..2ac2ce997 100644 --- a/src/gausskernel/storage/access/common/heaptuple.cpp +++ b/src/gausskernel/storage/access/common/heaptuple.cpp @@ -3281,6 +3281,7 @@ void heap_slot_store_heap_tuple(HeapTuple tuple, TupleTableSlot* slot, Buffer bu bool HeapKeepInvisbleTuple(HeapTuple tuple, TupleDesc tupleDesc, KeepInvisbleTupleFunc checkKeepFunc) { static KeepInvisbleOpt keepInvisibleArray[] = { + {PartitionRelationId, Anum_pg_partition_parttype, PartitionLocalIndexSkipping}, {PartitionRelationId, Anum_pg_partition_reloptions, PartitionInvisibleMetadataKeep}, {PartitionRelationId, Anum_pg_partition_parentid, PartitionParentOidIsLive}}; diff --git a/src/include/utils/partcache.h b/src/include/utils/partcache.h index 028491688..8010063e6 100644 --- a/src/include/utils/partcache.h +++ b/src/include/utils/partcache.h @@ -96,6 +96,7 @@ extern PartStatus PartitionGetMetadataStatus(Oid partOid, bool vacuumFlag); extern Datum SetWaitCleanGpiRelOptions(Datum oldOptions, bool enable); extern void PartitionedSetWaitCleanGpi(const char* parentName, Oid parentPartOid, bool enable, bool inplace); extern void PartitionSetWaitCleanGpi(Oid partOid, bool enable, bool inplace); +extern bool PartitionLocalIndexSkipping(Datum datumPartType); extern bool PartitionInvisibleMetadataKeep(Datum datumRelOptions); extern bool PartitionParentOidIsLive(Datum parentDatum); extern void PartitionedSetEnabledClean(Oid parentOid);