Skip to content

Commit

Permalink
[fix](nereids)mv selection should rule out shadow index from schema c…
Browse files Browse the repository at this point in the history
…hange (#37154)

schema change would introduce a shadow index. MV selection should rule
out the shadow index.
  • Loading branch information
starocean999 authored Jul 4, 2024
1 parent 7118d7c commit 841e39a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2990,4 +2990,13 @@ public long getRemoteDataSize() {
public long getReplicaCount() {
return statistics.getReplicaCount();
}

public boolean isShadowIndex(long indexId) {
String indexName = getIndexNameById(indexId);
if (indexName != null && indexName.startsWith(org.apache.doris.alter.SchemaChangeHandler.SHADOW_NAME_PREFIX)) {
return true;
} else {
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ private List<SyncMaterializationContext> createSyncMvContexts(OlapTable olapTabl
keyCount += column.isKey() ? 1 : 0;
}
for (Map.Entry<String, Long> entry : olapTable.getIndexNameToId().entrySet()) {
if (entry.getValue() != baseIndexId) {
long indexId = entry.getValue();
// when doing schema change, a shadow index would be created and put together with mv indexes
// we must roll out these unexpected shadow indexes here
if (indexId != baseIndexId && !olapTable.isShadowIndex(indexId)) {
MaterializedIndexMeta meta = olapTable.getIndexMetaByIndexId(entry.getValue());
String createMvSql;
if (meta.getDefineStmt() != null) {
Expand Down

0 comments on commit 841e39a

Please sign in to comment.