This is an automated email from the ASF dual-hosted git repository. xxyu pushed a commit to branch kylin5 in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 222d97d801bbfd842de179d808b9b5cd7000557e Author: Shuai li <loney...@live.cn> AuthorDate: Sun Oct 9 18:08:49 2022 +0800 Fix second storage secondary index change and not change table --- .../kap/secondstorage/SecondStorageIndexTest.java | 6 ++++-- .../secondstorage/management/SecondStorageService.java | 18 +++++------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/second-storage/clickhouse-it/src/test/java/io/kyligence/kap/secondstorage/SecondStorageIndexTest.java b/src/second-storage/clickhouse-it/src/test/java/io/kyligence/kap/secondstorage/SecondStorageIndexTest.java index 0a8ad1b714..fbfe232328 100644 --- a/src/second-storage/clickhouse-it/src/test/java/io/kyligence/kap/secondstorage/SecondStorageIndexTest.java +++ b/src/second-storage/clickhouse-it/src/test/java/io/kyligence/kap/secondstorage/SecondStorageIndexTest.java @@ -562,9 +562,11 @@ public class SecondStorageIndexTest implements JobWaiter { assertEquals(1, tableEntity.getSecondaryIndexColumns().size()); assertTrue(tableEntity.getSecondaryIndexColumns().contains(0)); - buildIncrementalLoadQuery("2012-01-02", "2012-01-03", new HashSet<>(getIndexPlan(modelId).getAllLayouts()), + buildIncrementalLoadQuery("2012-01-02", "2012-01-03", + new HashSet<>( + NIndexPlanManager.getInstance(getConfig(), getProject()).getIndexPlan(modelId).getAllLayouts()), modelId); - waitAllJoEnd(); + waitAllJobFinish(); for (TableData tableData : getTableFlow(modelId).getTableDataList()) { for (TablePartition partition : tableData.getPartitions()) { diff --git a/src/second-storage/core-ui/src/main/java/io/kyligence/kap/secondstorage/management/SecondStorageService.java b/src/second-storage/core-ui/src/main/java/io/kyligence/kap/secondstorage/management/SecondStorageService.java index c10c6c36ea..9c4fb6c2fc 100644 --- a/src/second-storage/core-ui/src/main/java/io/kyligence/kap/secondstorage/management/SecondStorageService.java +++ b/src/second-storage/core-ui/src/main/java/io/kyligence/kap/secondstorage/management/SecondStorageService.java @@ -326,6 +326,7 @@ public class SecondStorageService extends BasicService implements SecondStorageU deleteLayoutChTable(project, modelId, layout.getId()); EnhancedUnitOfWork.doInTransactionWithCheckAndRetry(() -> { getTablePlan(project, modelId).update(tp -> tp.updatePrimaryIndexColumns(layout.getId(), columns)); + deleteLayoutChTable(project, modelId, layout.getId()); return null; }, project, 1, UnitOfWork.DEFAULT_EPOCH_ID); } @@ -369,20 +370,11 @@ public class SecondStorageService extends BasicService implements SecondStorageU } private void deleteLayoutChTable(String project, String modelId, long layoutId) { - KylinConfig config = getConfig(); - String database = NameUtil.getDatabase(config, project); + String database = NameUtil.getDatabase(getConfig(), project); String table = NameUtil.getTable(modelId, layoutId); - for (NodeGroup nodeGroup : SecondStorageUtil.listNodeGroup(config, project)) { - nodeGroup.getNodeNames().forEach(node -> { - DatabaseOperator operator = SecondStorageFactoryUtils - .createDatabaseOperator(SecondStorageNodeHelper.resolve(node)); - try { - operator.dropTable(database, table); - } catch (Exception e) { - throw new KylinException(SECOND_STORAGE_NODE_NOT_AVAILABLE, - MsgPicker.getMsg().getSecondStorageNodeNotAvailable(node), e); - } - }); + for (NodeGroup nodeGroup : SecondStorageUtil.listNodeGroup(getConfig(), project)) { + nodeGroup.getNodeNames().forEach(node -> SecondStorageFactoryUtils + .createDatabaseOperator(SecondStorageNodeHelper.resolve(node)).dropTable(database, table)); } }