This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 8f0552ee61313915cda5157b0d6c5c457e5e31ab
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Thu Aug 1 20:06:18 2024 +0800

    [fix](Nereids) remove db readlock before get table from db (#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 34d6d7860e6..306da4d0c50 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
@@ -553,16 +553,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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to