This is an automated email from the ASF dual-hosted git repository.
w41ter 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 6ccf2cdce6d [chore](binlog) GetMeta returns dropped
partition/table/index commit seq (#48852)
6ccf2cdce6d is described below
commit 6ccf2cdce6d4f7c1c253063f9cd95e2a14eb3668
Author: walter <[email protected]>
AuthorDate: Tue Mar 11 11:22:16 2025 +0800
[chore](binlog) GetMeta returns dropped partition/table/index commit seq
(#48852)
---
.../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 eac4e6e34e8..b0d0baa433e 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
@@ -545,7 +545,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);
@@ -559,7 +559,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);
@@ -573,7 +573,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 a9594dc3298..8ab9ff7b920 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
@@ -47,7 +47,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);
@@ -233,36 +232,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 206d61c7e28..f88653ade36 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
@@ -6761,9 +6761,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 b48e640f412..c2031a31fd8 100644
--- a/gensrc/thrift/FrontendService.thrift
+++ b/gensrc/thrift/FrontendService.thrift
@@ -1455,9 +1455,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: [email protected]
For additional commands, e-mail: [email protected]