submit code to openGauss-server

Offering: openGaussDev

More detail:fix并发index unusable和rebuild死锁

Signed-off-by:lihaixiao lihaixiao3@huawei.com

Match-id-2339b79686a9ccf5f7eff94b2678e0fb283659b6
This commit is contained in:
openGaussDev
2022-03-09 10:46:02 +08:00
committed by yanghao
parent 88e3ad9fb4
commit 6e76940206

View File

@ -596,6 +596,9 @@ void BlockUnsupportedDDL(const Node* parsetree)
if (stmt->relation) {
relid = RangeVarGetRelid(stmt->relation, AccessShareLock, true);
if (OidIsValid(relid)) {
/* release index lock before lock table to avoid deadlock */
UnlockRelationOid(relid, AccessShareLock);
Relation relation = relation_open(relid, NoLock);
bool inRedis = false;
@ -608,8 +611,6 @@ void BlockUnsupportedDDL(const Node* parsetree)
relation_close(heapRelation, AccessShareLock);
}
relation_close(relation, NoLock);
UnlockRelationOid(relid, AccessShareLock);
if (inRedis) {
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),