This is an automated email from the ASF dual-hosted git repository.

menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 2f2b58f93d4 Fix "show migration list" getting job sharding infos 
failure when job is inactive (#35418)
2f2b58f93d4 is described below

commit 2f2b58f93d4e438c25d881946b1fc94670a9f1b9
Author: Hongsheng Zhong <zhonghongsh...@apache.org>
AuthorDate: Thu May 15 13:00:52 2025 +0800

    Fix "show migration list" getting job sharding infos failure when job is 
inactive (#35418)
---
 .../migration/query/ShowMigrationListExecutor.java      | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git 
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/distsql/handler/migration/query/ShowMigrationListExecutor.java
 
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/distsql/handler/migration/query/ShowMigrationListExecutor.java
index fc57e46c7a8..536750800df 100644
--- 
a/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/distsql/handler/migration/query/ShowMigrationListExecutor.java
+++ 
b/kernel/data-pipeline/distsql/handler/src/main/java/org/apache/shardingsphere/data/pipeline/distsql/handler/migration/query/ShowMigrationListExecutor.java
@@ -51,12 +51,23 @@ public final class ShowMigrationListExecutor implements 
DistSQLQueryExecutor<Sho
     }
     
     private LocalDataQueryResultRow getRow(final PipelineContextKey 
contextKey, final PipelineJobInfo jobInfo) {
-        return new 
LocalDataQueryResultRow(jobInfo.getJobMetaData().getJobId(), 
jobInfo.getTableName(), jobInfo.getJobMetaData().isActive(), 
jobInfo.getJobMetaData().getCreateTime(),
-                jobInfo.getJobMetaData().getStopTime(), 
jobInfo.getJobMetaData().getJobItemCount(), getJobShardingNodes(contextKey, 
jobInfo.getJobMetaData().getJobId()));
+        boolean active = jobInfo.getJobMetaData().isActive();
+        String jobShardingNodes = active ? getJobShardingNodes(contextKey, 
jobInfo.getJobMetaData().getJobId()) : "";
+        return new 
LocalDataQueryResultRow(jobInfo.getJobMetaData().getJobId(), 
jobInfo.getTableName(), active, jobInfo.getJobMetaData().getCreateTime(),
+                jobInfo.getJobMetaData().getStopTime(), 
jobInfo.getJobMetaData().getJobItemCount(), jobShardingNodes);
     }
     
     private String getJobShardingNodes(final PipelineContextKey contextKey, 
final String jobId) {
-        Collection<ShardingInfo> shardingInfos = 
pipelineJobManager.getJobShardingInfos(contextKey, jobId);
+        // SPEX CHANGED: BEGIN
+        Collection<ShardingInfo> shardingInfos;
+        try {
+            shardingInfos = pipelineJobManager.getJobShardingInfos(contextKey, 
jobId);
+            // CHECKSTYLE:OFF
+        } catch (final RuntimeException ignored) {
+            // CHECKSTYLE:ON
+            return "";
+        }
+        // SPEX CHANGED: END
         return shardingInfos.isEmpty() ? "" : 
getJobShardingNodes(shardingInfos);
     }
     

Reply via email to