Skip to content

Commit

Permalink
[fix](editlog) Fix replay BatchDropInfo (#45077)
Browse files Browse the repository at this point in the history
introduced by #44677

The new field `indexNameMap` does not exist in the former version of the
persisted metadata, and should be skipped during replaying.
  • Loading branch information
w41ter authored and Your Name committed Dec 6, 2024
1 parent 4511e0f commit c661d2f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ public Set<Long> getIndexIdSet() {
return indexIdSet;
}

public boolean hasIndexNameMap() {
return indexNameMap != null;
}

public Map<Long, String> getIndexNameMap() {
return indexNameMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public DropInfo() {

public DropInfo(long dbId, long tableId, String tableName, boolean isView, boolean forceDrop,
long recycleTime) {
this(dbId, tableId, tableName, -1, "", isView, forceDrop, recycleTime);
this(dbId, tableId, tableName, -1L, "", isView, forceDrop, recycleTime);
}

public DropInfo(long dbId, long tableId, String tableName, long indexId, String indexName, boolean isView,
Expand Down
22 changes: 15 additions & 7 deletions fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,21 @@ public static void loadJournal(Env env, Long logId, JournalEntity journal) {
}
case OperationType.OP_BATCH_DROP_ROLLUP: {
BatchDropInfo batchDropInfo = (BatchDropInfo) journal.getData();
for (Map.Entry<Long, String> entry : batchDropInfo.getIndexNameMap().entrySet()) {
long indexId = entry.getKey();
String indexName = entry.getValue();
DropInfo info = new DropInfo(batchDropInfo.getDbId(), batchDropInfo.getTableId(),
batchDropInfo.getTableName(), indexId, indexName, false, false, 0);
env.getMaterializedViewHandler().replayDropRollup(info, env);
env.getBinlogManager().addDropRollup(info, logId);
if (batchDropInfo.hasIndexNameMap()) {
for (Map.Entry<Long, String> entry : batchDropInfo.getIndexNameMap().entrySet()) {
long indexId = entry.getKey();
String indexName = entry.getValue();
DropInfo info = new DropInfo(batchDropInfo.getDbId(), batchDropInfo.getTableId(),
batchDropInfo.getTableName(), indexId, indexName, false, false, 0);
env.getMaterializedViewHandler().replayDropRollup(info, env);
env.getBinlogManager().addDropRollup(info, logId);
}
} else {
for (Long indexId : batchDropInfo.getIndexIdSet()) {
DropInfo info = new DropInfo(batchDropInfo.getDbId(), batchDropInfo.getTableId(),
batchDropInfo.getTableName(), indexId, "", false, false, 0);
env.getMaterializedViewHandler().replayDropRollup(info, env);
}
}
break;
}
Expand Down

0 comments on commit c661d2f

Please sign in to comment.