Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](nereids)mv selection should rule out shadow index from schema change #37154

Merged
merged 2 commits into from
Jul 4, 2024
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 @@ -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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some comment to explain shadowIndex

MaterializedIndexMeta meta = olapTable.getIndexMetaByIndexId(entry.getValue());
String createMvSql;
if (meta.getDefineStmt() != null) {
Expand Down
Loading