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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 5a93358974b branch-3.0: [chore](binlog) GetMeta returns dropped 
partition/table/index commit seq #48852 (#48899)
5a93358974b is described below

commit 5a93358974bbe19f924510be76caaccd218b6693
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Mar 12 10:14:14 2025 +0800

    branch-3.0: [chore](binlog) GetMeta returns dropped partition/table/index 
commit seq #48852 (#48899)
    
    Cherry-picked from #48852
    
    Co-authored-by: walter <maoch...@selectdb.com>
---
 .../org/apache/doris/binlog/BinlogManager.java     |  6 +++---
 .../java/org/apache/doris/binlog/DBBinlog.java     | 19 ++++++------------
 .../main/java/org/apache/doris/catalog/Env.java    | 23 +++++++++++++++++++---
 gensrc/thrift/FrontendService.thrift               |  9 ++++++---
 4 files changed, 35 insertions(+), 22 deletions(-)

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 2a06bf27b6f..fb940e8c554 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
@@ -541,7 +541,7 @@ public class BinlogManager {
     }
 
     // get the dropped partitions of the db.
-    public List<Long> getDroppedPartitions(long dbId) {
+    public List<Pair<Long, Long>> getDroppedPartitions(long dbId) {
         lock.readLock().lock();
         try {
             DBBinlog dbBinlog = dbBinlogMap.get(dbId);
@@ -555,7 +555,7 @@ public class BinlogManager {
     }
 
     // get the dropped tables of the db.
-    public List<Long> getDroppedTables(long dbId) {
+    public List<Pair<Long, Long>> getDroppedTables(long dbId) {
         lock.readLock().lock();
         try {
             DBBinlog dbBinlog = dbBinlogMap.get(dbId);
@@ -569,7 +569,7 @@ public class BinlogManager {
     }
 
     // get the dropped indexes of the db.
-    public List<Long> getDroppedIndexes(long dbId) {
+    public List<Pair<Long, Long>> getDroppedIndexes(long dbId) {
         lock.readLock().lock();
         try {
             DBBinlog dbBinlog = dbBinlogMap.get(dbId);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java 
b/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java
index 8e2c7bbde96..b65f91e7b22 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java
@@ -46,7 +46,6 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.TreeSet;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.stream.Collectors;
 
 public class DBBinlog {
     private static final Logger LOG = 
LogManager.getLogger(BinlogManager.class);
@@ -232,36 +231,30 @@ public class DBBinlog {
     }
 
     // Get the dropped partitions of the db.
-    public List<Long> getDroppedPartitions() {
+    public List<Pair<Long, Long>> getDroppedPartitions() {
         lock.readLock().lock();
         try {
-            return droppedPartitions.stream()
-                    .map(v -> v.first)
-                    .collect(Collectors.toList());
+            return new ArrayList<>(droppedPartitions);
         } finally {
             lock.readLock().unlock();
         }
     }
 
     // Get the dropped tables of the db.
-    public List<Long> getDroppedTables() {
+    public List<Pair<Long, Long>> getDroppedTables() {
         lock.readLock().lock();
         try {
-            return droppedTables.stream()
-                    .map(v -> v.first)
-                    .collect(Collectors.toList());
+            return new ArrayList<>(droppedTables);
         } finally {
             lock.readLock().unlock();
         }
     }
 
     // Get the dropped indexes of the db.
-    public List<Long> getDroppedIndexes() {
+    public List<Pair<Long, Long>> getDroppedIndexes() {
         lock.readLock().lock();
         try {
-            return droppedIndexes.stream()
-                    .map(v -> v.first)
-                    .collect(Collectors.toList());
+            return new ArrayList<>(droppedIndexes);
         } finally {
             lock.readLock().unlock();
         }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index c75609a4c7b..d60b16f4d06 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -6580,9 +6580,26 @@ public class Env {
 
         if (Config.enable_feature_binlog) {
             BinlogManager binlogManager = 
Env.getCurrentEnv().getBinlogManager();
-            
dbMeta.setDroppedPartitions(binlogManager.getDroppedPartitions(db.getId()));
-            
dbMeta.setDroppedTables(binlogManager.getDroppedTables(db.getId()));
-            
dbMeta.setDroppedIndexes(binlogManager.getDroppedIndexes(db.getId()));
+            // id -> commit seq
+            List<Pair<Long, Long>> droppedPartitions = 
binlogManager.getDroppedPartitions(db.getId());
+            List<Pair<Long, Long>> droppedTables = 
binlogManager.getDroppedTables(db.getId());
+            List<Pair<Long, Long>> droppedIndexes = 
binlogManager.getDroppedIndexes(db.getId());
+            dbMeta.setDroppedPartitionMap(droppedPartitions.stream()
+                    .collect(Collectors.toMap(p -> p.first, p -> p.second)));
+            dbMeta.setDroppedTableMap(droppedTables.stream()
+                    .collect(Collectors.toMap(p -> p.first, p -> p.second)));
+            dbMeta.setDroppedIndexMap(droppedIndexes.stream()
+                    .collect(Collectors.toMap(p -> p.first, p -> p.second)));
+            // Keep compatibility with old version
+            dbMeta.setDroppedPartitions(droppedPartitions.stream()
+                    .map(p -> p.first)
+                    .collect(Collectors.toList()));
+            dbMeta.setDroppedTables(droppedTables.stream()
+                    .map(p -> p.first)
+                    .collect(Collectors.toList()));
+            dbMeta.setDroppedIndexes(droppedIndexes.stream()
+                    .map(p -> p.first)
+                    .collect(Collectors.toList()));
         }
 
         result.setDbMeta(dbMeta);
diff --git a/gensrc/thrift/FrontendService.thrift 
b/gensrc/thrift/FrontendService.thrift
index 1f91a7db1d0..48929ef721b 100644
--- a/gensrc/thrift/FrontendService.thrift
+++ b/gensrc/thrift/FrontendService.thrift
@@ -1649,9 +1649,12 @@ struct TGetMetaDBMeta {
     1: optional i64 id
     2: optional string name
     3: optional list<TGetMetaTableMeta> tables
-    4: optional list<i64> dropped_partitions
-    5: optional list<i64> dropped_tables
-    6: optional list<i64> dropped_indexes
+    4: optional list<i64> dropped_partitions    // DEPRECATED
+    5: optional list<i64> dropped_tables        // DEPRECATED
+    6: optional list<i64> dropped_indexes       // DEPRECATED
+    7: optional map<i64, i64> dropped_partition_map     // id -> commit seq
+    8: optional map<i64, i64> dropped_table_map         // id -> commit seq
+    9: optional map<i64, i64> dropped_index_map         // id -> commit seq
 }
 
 struct TGetMetaResult {


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

Reply via email to