Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ public Pair<TStatus, Long> lockBinlog(long dbId, long tableId,
}

// 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);
Expand All @@ -539,7 +539,7 @@ public List<Long> getDroppedPartitions(long dbId) {
}

// 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);
Expand All @@ -553,7 +553,7 @@ public List<Long> getDroppedTables(long dbId) {
}

// 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);
Expand Down
19 changes: 6 additions & 13 deletions fe/fe-core/src/main/java/org/apache/doris/binlog/DBBinlog.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
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);
Expand Down Expand Up @@ -232,36 +231,30 @@ public Pair<TStatus, List<TBinlog>> getBinlog(long tableId, long prevCommitSeq,
}

// 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();
}
Expand Down
23 changes: 20 additions & 3 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -6272,9 +6272,26 @@ public static TGetMetaResult getMeta(Database db, List<Table> tables) throws Met

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);
Expand Down
9 changes: 6 additions & 3 deletions gensrc/thrift/FrontendService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -1594,9 +1594,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 {
Expand Down
Loading