!1432 fix bug for local index with fastupdate for partition

Merge pull request !1432 from zhengxue/master_dev
This commit is contained in:
opengauss-bot 2022-01-04 01:25:57 +00:00 committed by Gitee
commit ab5354ef25
3 changed files with 24 additions and 0 deletions

View File

@ -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
*

View File

@ -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}};

View File

@ -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);