You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/07/26 03:49:19 UTC
[doris] branch master updated: [bug](FE): Fix show alter column return incorrect job progress (#11184)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new e54b57107a [bug](FE): Fix show alter column return incorrect job progress (#11184)
e54b57107a is described below
commit e54b57107a146f94e8f83b38b3600baac49916c2
Author: AlexYue <yj...@qq.com>
AuthorDate: Tue Jul 26 11:49:14 2022 +0800
[bug](FE): Fix show alter column return incorrect job progress (#11184)
bugfix:now show altr table return correct job progress
---
.../apache/doris/alter/SchemaChangeHandler.java | 23 ++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
index c93907d722..2697f6c200 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
@@ -2198,6 +2198,24 @@ public class SchemaChangeHandler extends AlterHandler {
throw new DdlException("Nothing is changed. please check your alter stmt.");
}
+ //for compatibility, we need create a finished state schema change job v2
+
+ SchemaChangeJobV2 schemaChangeJob = new SchemaChangeJobV2(jobId, db.getId(), olapTable.getId(),
+ olapTable.getName(), 1000);
+
+ for (Map.Entry<Long, List<Column>> entry : changedIndexIdToSchema.entrySet()) {
+ long originIndexId = entry.getKey();
+ String newIndexName = SHADOW_NAME_PRFIX + olapTable.getIndexNameById(originIndexId);
+ MaterializedIndexMeta currentIndexMeta = olapTable.getIndexMetaByIndexId(originIndexId);
+ // 1. get new schema version/schema version hash, short key column count
+ int currentSchemaVersion = currentIndexMeta.getSchemaVersion();
+ int newSchemaVersion = currentSchemaVersion + 1;
+ // generate schema hash for new index has to generate a new schema hash not equal to current schema hash
+ schemaChangeJob.addIndexSchema(originIndexId, originIndexId, newIndexName, newSchemaVersion,
+ currentIndexMeta.getSchemaHash(),
+ currentIndexMeta.getShortKeyColumnCount(), entry.getValue());
+ }
+
//update base index schema
long baseIndexId = olapTable.getBaseIndexId();
List<Long> indexIds = new ArrayList<Long>();
@@ -2231,10 +2249,7 @@ public class SchemaChangeHandler extends AlterHandler {
Catalog.getCurrentCatalog().getEditLog().logModifyTableAddOrDropColumns(info);
}
- //for compatibility, we need create a finished state schema change job v2
-
- SchemaChangeJobV2 schemaChangeJob = new SchemaChangeJobV2(jobId, db.getId(), olapTable.getId(),
- olapTable.getName(), 1000);
+ // set Job state then add job
schemaChangeJob.setJobState(AlterJobV2.JobState.FINISHED);
schemaChangeJob.setFinishedTimeMs(System.currentTimeMillis());
this.addAlterJobV2(schemaChangeJob);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org