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

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


The following commit(s) were added to refs/heads/master by this push:
     new 991eaec0ca1 [feat](binlog) filter the temp table related binlogs 
(#49755)
991eaec0ca1 is described below

commit 991eaec0ca178d883d49f8db164391bdc55eae4f
Author: koarz <[email protected]>
AuthorDate: Tue Apr 15 22:23:25 2025 +0800

    [feat](binlog) filter the temp table related binlogs (#49755)
---
 .../org/apache/doris/binlog/BinlogConfigCache.java   | 15 +++++++++++++++
 .../java/org/apache/doris/binlog/BinlogManager.java  | 20 +++++++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java 
b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java
index 0bce3f375aa..2cf7f065770 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogConfigCache.java
@@ -148,6 +148,21 @@ public class BinlogConfigCache {
         }
     }
 
+    public boolean isTemporaryTable(long dbId, long tableId) {
+        Database db = Env.getCurrentInternalCatalog().getDbNullable(dbId);
+        if (db == null) {
+            LOG.warn("db not found. dbId: {}", dbId);
+            return false;
+        }
+
+        Table table = db.getTableNullable(tableId);
+        if (table == null) {
+            LOG.warn("fail to get table. db: {}, table id: {}", 
db.getFullName(), tableId);
+            return false;
+        }
+        return table.isTemporary();
+    }
+
     public boolean isEnableTable(long dbId, long tableId) {
         BinlogConfig tableBinlogConfig = getTableBinlogConfig(dbId, tableId);
         if (tableBinlogConfig == null) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java 
b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
index f11149af885..f1c25f57c85 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/BinlogManager.java
@@ -126,12 +126,30 @@ public class BinlogManager {
         return false;
     }
 
+    private boolean isTemporaryTable(TBinlog binlog) {
+        if (!binlog.isSetTableIds()) {
+            return false;
+        }
+
+        // Filter the binlogs belong to temporary table
+        for (long tableId : binlog.getTableIds()) {
+            if (binlogConfigCache.isTemporaryTable(binlog.getDbId(), tableId)) 
{
+                LOG.debug("filter the temporary table binlog, db {}, table {}, 
commit seq {}, ts {}, type {}, data {}",
+                        binlog.getDbId(), binlog.getTableIds(), 
binlog.getCommitSeq(), binlog.getTimestamp(),
+                        binlog.getType(), binlog.getData());
+                return true;
+            }
+        }
+
+        return false;
+    }
+
     private void addBinlog(TBinlog binlog, Object raw) {
         if (!Config.enable_feature_binlog) {
             return;
         }
 
-        if (isAsyncMvBinlog(binlog)) {
+        if (isAsyncMvBinlog(binlog) || isTemporaryTable(binlog)) {
             return;
         }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to