This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new e140613ae1f [fix](Nereids) remove db readlock before get table from db
(#38660) (#38729)
e140613ae1f is described below
commit e140613ae1f3a876b11a5bbc190afb37d6041863
Author: morrySnow <[email protected]>
AuthorDate: Fri Aug 2 08:34:59 2024 +0800
[fix](Nereids) remove db readlock before get table from db (#38660) (#38729)
pick from master #38660
insert will hold readlock of target table before planning. if nereids
need db readlock after it, will lead to dead lock. because other
statement need to hold db lock before get table lock
for example:
insert: target table read lock -> database read lock
drop table: database write lock -> target table write lock
---
.../java/org/apache/doris/nereids/CascadesContext.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java
index a0d748c08c7..a206209508b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/CascadesContext.java
@@ -552,16 +552,13 @@ public class CascadesContext implements ScheduleContext {
if (db == null) {
throw new RuntimeException("Database [" + dbName + "] does not
exist in catalog [" + ctlName + "].");
}
- db.readLock();
- try {
- TableIf table = db.getTableNullable(tableName);
- if (table == null) {
- throw new RuntimeException("Table [" + tableName + "] does not
exist in database [" + dbName + "].");
- }
- return table;
- } finally {
- db.readUnlock();
+
+ TableIf table = db.getTableNullable(tableName);
+ if (table == null) {
+ throw new RuntimeException("Table [" + tableName + "] does not
exist in database [" + dbName + "].");
}
+ return table;
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]