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 342b55afc2b branch-2.1: [fix](binlog) get table with db lock if the 
table not exists #49566 (#49648)
342b55afc2b is described below

commit 342b55afc2b82e7cb89ddfd68da0393b8e772dc9
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Apr 4 20:46:58 2025 +0800

    branch-2.1: [fix](binlog) get table with db lock if the table not exists 
#49566 (#49648)
    
    Cherry-picked from #49566
    
    Co-authored-by: walter <maoch...@selectdb.com>
---
 .../org/apache/doris/service/FrontendServiceImpl.java     | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java 
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index d48418c7f25..ccba47396f9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -4032,6 +4032,21 @@ public class FrontendServiceImpl implements 
FrontendService.Iface {
                         table = db.getTableNullable(getMetaTable.getName());
                     }
 
+                    if (table == null) {
+                        // Since Database.getTableNullable is lock-free, we 
need to take lock and check again,
+                        // to ensure the visibility of the table.
+                        db.readLock();
+                        try {
+                            if (getMetaTable.isSetId()) {
+                                table = 
db.getTableNullable(getMetaTable.getId());
+                            } else {
+                                table = 
db.getTableNullable(getMetaTable.getName());
+                            }
+                        } finally {
+                            db.readUnlock();
+                        }
+                    }
+
                     if (table == null) {
                         LOG.warn("table not found {}", getMetaTable);
                         continue;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to