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 98a59f914a5 branch-2.1: [chore](binlog) GetMeta returns dropped
partition/table/index commit seq #48852 (#48900)
98a59f914a5 is described below
commit 98a59f914a5cbc34a9ff333769b1d373f6372b73
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Mar 17 14:03:09 2025 +0800
branch-2.1: [chore](binlog) GetMeta returns dropped partition/table/index
commit seq #48852 (#48900)
Cherry-picked from #48852
Co-authored-by: walter <[email protected]>
---
.../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 d6d0e568dee..b35092a830d 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
@@ -525,7 +525,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);
@@ -539,7 +539,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);
@@ -553,7 +553,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 1c242c97761..9959a6275ec 100755
--- 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
@@ -6308,9 +6308,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 7002dc74ef5..3018924064b 100644
--- a/gensrc/thrift/FrontendService.thrift
+++ b/gensrc/thrift/FrontendService.thrift
@@ -1596,9 +1596,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]