diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/ConsistencyCheckJobItemInfo.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/ConsistencyCheckJobItemInfo.java index db7b605b71ebd..6768dfd352caf 100644 --- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/ConsistencyCheckJobItemInfo.java +++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/pojo/ConsistencyCheckJobItemInfo.java @@ -29,6 +29,8 @@ @Setter public final class ConsistencyCheckJobItemInfo { + private boolean active; + private String tableNames; private Boolean checkSuccess; diff --git a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java index a1f95255599b5..c5b117fd9f7db 100644 --- a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java +++ b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutor.java @@ -49,6 +49,7 @@ public Collection getRows(final ShowMigrationCheckStatu private LocalDataQueryResultRow convert(final ConsistencyCheckJobItemInfo info) { String checkResult = null == info.getCheckSuccess() ? "" : info.getCheckSuccess().toString(); return new LocalDataQueryResultRow(Optional.ofNullable(info.getTableNames()).orElse(""), checkResult, Optional.ofNullable(info.getCheckFailedTableNames()).orElse(""), + info.isActive() ? Boolean.TRUE.toString() : Boolean.FALSE.toString(), String.valueOf(info.getInventoryFinishedPercentage()), info.getInventoryRemainingSeconds(), info.getIncrementalIdleSeconds(), Optional.ofNullable(info.getCheckBeginTime()).orElse(""), Optional.ofNullable(info.getCheckEndTime()).orElse(""), info.getDurationSeconds(), info.getAlgorithmType(), Optional.ofNullable(info.getAlgorithmProps()).orElse(""), Optional.ofNullable(info.getErrorMessage()).orElse("")); @@ -56,7 +57,7 @@ private LocalDataQueryResultRow convert(final ConsistencyCheckJobItemInfo info) @Override public Collection getColumnNames() { - return Arrays.asList("tables", "result", "check_failed_tables", "inventory_finished_percentage", "inventory_remaining_seconds", "incremental_idle_seconds", + return Arrays.asList("tables", "result", "check_failed_tables", "active", "inventory_finished_percentage", "inventory_remaining_seconds", "incremental_idle_seconds", "check_begin_time", "check_end_time", "duration_seconds", "algorithm_type", "algorithm_props", "error_message"); } diff --git a/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutorTest.java b/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutorTest.java index 4ffef5d5e08bb..4f2c4b66145f1 100644 --- a/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutorTest.java +++ b/kernel/data-pipeline/distsql/handler/src/test/java/org/apache/shardingsphere/migration/distsql/handler/query/ShowMigrationCheckStatusExecutorTest.java @@ -32,11 +32,12 @@ class ShowMigrationCheckStatusExecutorTest { @Test void assertGetColumnNames() { Collection columns = executor.getColumnNames(); - assertThat(columns.size(), is(12)); + assertThat(columns.size(), is(13)); Iterator iterator = columns.iterator(); assertThat(iterator.next(), is("tables")); assertThat(iterator.next(), is("result")); assertThat(iterator.next(), is("check_failed_tables")); + assertThat(iterator.next(), is("active")); assertThat(iterator.next(), is("inventory_finished_percentage")); assertThat(iterator.next(), is("inventory_remaining_seconds")); assertThat(iterator.next(), is("incremental_idle_seconds")); diff --git a/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java b/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java index 4eedb50c8cd59..8077fb46dff0f 100644 --- a/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java +++ b/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java @@ -300,6 +300,8 @@ private ConsistencyCheckJobItemInfo getJobItemInfo(final String parentJobId) { String checkJobId = latestCheckJobId.get(); Optional progress = getJobItemProgress(checkJobId, 0); ConsistencyCheckJobItemInfo result = new ConsistencyCheckJobItemInfo(); + JobConfigurationPOJO jobConfigPOJO = getElasticJobConfigPOJO(checkJobId); + result.setActive(!jobConfigPOJO.isDisabled()); if (!progress.isPresent()) { return result; } @@ -321,7 +323,6 @@ private ConsistencyCheckJobItemInfo getJobItemInfo(final String parentJobId) { result.setInventoryRemainingSeconds(0L); } else if (0 != recordsCount && 0 != checkedRecordsCount) { result.setInventoryFinishedPercentage((int) (checkedRecordsCount * 100 / recordsCount)); - JobConfigurationPOJO jobConfigPOJO = getElasticJobConfigPOJO(checkJobId); Long stopTimeMillis = jobConfigPOJO.isDisabled() ? Long.parseLong(jobConfigPOJO.getProps().getProperty("stop_time_millis")) : null; long durationMillis = (null != stopTimeMillis ? stopTimeMillis : System.currentTimeMillis()) - jobItemProgress.getCheckBeginTimeMillis(); result.setDurationSeconds(TimeUnit.MILLISECONDS.toSeconds(durationMillis));