sync code

This commit is contained in:
LiHeng
2022-03-04 23:22:16 +08:00
parent d26ec83e7b
commit de223dd152
2618 changed files with 382415 additions and 163216 deletions

View File

@ -156,15 +156,6 @@ void RecordDeletedTuple(Oid relid, int2 bucketid, const ItemPointer tupleid, con
tableam_tops_free_tuple(tup);
}
/*
* - Brief: get and open delete_delta rel
* - Parameter:
* @rel: target relation of UPDATE/DELETE/TRUNCATE operation
* @lockmode: lock mode
* @isMultiCatchup: multi catchup delta or not
* - Return:
* delete_delta rel
*/
/*
* - Brief: Determine if the relation is under cluster resizing operation
* - Parameter:
@ -203,6 +194,25 @@ bool RelationInClusterResizingReadOnly(const Relation rel)
return false;
}
/*
* - Brief: Determine if the relation is under cluster resizing read only operation
* - Parameter:
* @rel: relation that needs to check
* - Return:
* @TRUE: relation is under cluster resizing endcatchup(write error)
* @FALSE: relation is not under cluster resizing endcatchup(write error)
*/
bool RelationInClusterResizingEndCatchup(const Relation rel)
{
Assert(rel != NULL);
/* Check relation's append_mode status */
if (!IsInitdb && RelationInRedistributeEndCatchup(rel))
return true;
return false;
}
/*
* @Description: check whether relation is in redistribution though range variable.
* @in range_var: range variable which stored relation info.
@ -370,6 +380,15 @@ static inline void RelationGetDeleteDeltaTableName(Relation rel, char* delete_de
return;
}
/*
* - Brief: get and open delete_delta rel
* - Parameter:
* @rel: target relation of UPDATE/DELETE/TRUNCATE operation
* @lockmode: lock mode
* @isMultiCatchup: multi catchup delta or not
* - Return:
* delete_delta rel
*/
Relation GetAndOpenDeleteDeltaRel(const Relation rel, LOCKMODE lockmode, bool isMultiCatchup)
{
Relation deldelta_rel;
@ -1201,3 +1220,18 @@ void RelationGetNewTableName(Relation rel, char* newtable_name)
}
return;
}
/*
* - Brief: Determine if the relation is under cluster resizing write error mode
* - Parameter:
* @rel: relation that needs to check
* - Return:
* @TRUE: relation is under cluster resizing write error mode
* @FALSE: relation is not under cluster resizing write error mode
*/
bool RelationInClusterResizingWriteErrorMode(const Relation rel)
{
return RelationInClusterResizingReadOnly(rel) ||
(RelationInClusterResizingEndCatchup(rel) && !pg_try_advisory_lock_for_redis(rel));
}