From 6e76940206246651b229309b066500c45cebc8ae Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Wed, 9 Mar 2022 10:46:02 +0800 Subject: [PATCH] submit code to openGauss-server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Offering: openGaussDev More detail:fix并发index unusable和rebuild死锁 Signed-off-by:lihaixiao lihaixiao3@huawei.com Match-id-2339b79686a9ccf5f7eff94b2678e0fb283659b6 --- src/gausskernel/runtime/executor/execClusterResize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gausskernel/runtime/executor/execClusterResize.cpp b/src/gausskernel/runtime/executor/execClusterResize.cpp index 0dc5b3f2b..4eb0444a5 100644 --- a/src/gausskernel/runtime/executor/execClusterResize.cpp +++ b/src/gausskernel/runtime/executor/execClusterResize.cpp @@ -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),