Copilot commented on code in PR #62270:
URL: https://github.com/apache/doris/pull/62270#discussion_r3056248397


##########
regression-test/suites/job_p0/streaming_job/test_streaming_job_retry_info.groovy:
##########
@@ -0,0 +1,139 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+import org.awaitility.Awaitility
+
+import static java.util.concurrent.TimeUnit.SECONDS
+
+// Verify that RetryInfo and LastTaskSuccessTime TVF columns are populated 
correctly.
+// 1. After a successful task, LastTaskSuccessTime should be set.
+// 2. After failures and retries, RetryInfo should contain retryCount.
+// 3. After manual resume, retryCount should be reset to 0.
+suite("test_streaming_job_retry_info", "nonConcurrent") {
+    def tableName = "test_streaming_job_retry_info_tbl"
+    def jobName = "test_streaming_job_retry_info_job"
+
+    sql """drop table if exists `${tableName}` force"""
+    sql """
+        DROP JOB IF EXISTS where jobname = '${jobName}'
+    """
+
+    sql """
+        CREATE TABLE IF NOT EXISTS ${tableName} (
+            `c1` int NULL,
+            `c2` string NULL,
+            `c3` int  NULL,
+        ) ENGINE=OLAP
+        DUPLICATE KEY(`c1`)
+        COMMENT 'OLAP'
+        DISTRIBUTED BY HASH(`c1`) BUCKETS 3
+        PROPERTIES ("replication_allocation" = "tag.location.default: 1");
+    """
+
+    // case1: Verify LastTaskSuccessTime is set after successful task
+    sql """
+       CREATE JOB ${jobName}
+       PROPERTIES(
+           "s3.max_batch_files" = "1"
+       )
+       ON STREAMING DO INSERT INTO ${tableName}
+       SELECT * FROM S3
+        (
+            "uri" = 
"s3://${s3BucketName}/regression/load/data/example_[0-1].csv",
+            "format" = "csv",
+            "provider" = "${getS3Provider()}",
+            "column_separator" = ",",
+            "s3.endpoint" = "${getS3Endpoint()}",
+            "s3.region" = "${getS3Region()}",
+            "s3.access_key" = "${getS3AK()}",
+            "s3.secret_key" = "${getS3SK()}"
+        );
+    """
+
+    try {
+        // Wait for at least one successful task
+        Awaitility.await().atMost(120, SECONDS)
+                .pollInterval(2, SECONDS).until(
+                {
+                    def jobRes = sql """ select SucceedTaskCount from 
jobs("type"="insert") where Name = '${jobName}' and ExecuteType='STREAMING' """
+                    log.info("jobRes: " + jobRes)
+                    jobRes.size() == 1 && '0' < jobRes.get(0).get(0)

Review Comment:
   This compares a string literal `'0'` with a value that is likely numeric (or 
a numeric-form string) via `<`, which is brittle and can behave unexpectedly 
(lexicographic compare or type coercion issues). Recommended fix: cast/parse 
the value to an integer/long and compare numerically (e.g., 
`jobRes.get(0).get(0) as long`).
   ```suggestion
                       jobRes.size() == 1 && (jobRes.get(0).get(0) as long) > 0L
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/job/scheduler/StreamingTaskScheduler.java:
##########
@@ -94,9 +94,13 @@ private void scheduleTasks(List<AbstractStreamingTask> 
tasks) {
                             (StreamingInsertJob) 
Env.getCurrentEnv().getJobManager().getJob(task.getJobId());
                     job.setFailureReason(new FailureReason(e.getMessage()));
                     try {
-                        job.updateJobStatus(JobStatus.PAUSED);
+                        if (job.isResumableFailure(job.getFailureReason())) {
+                            job.updateJobStatus(JobStatus.RETRYING);
+                        } else {
+                            job.updateJobStatus(JobStatus.PAUSED);
+                        }
                     } catch (JobException ex) {

Review Comment:
   `job.updateJobStatus(JobStatus.RETRYING)` can throw 
`IllegalArgumentException` (e.g., if the job is already `RETRYING`), but the 
code only catches `JobException`. This can escape the current handler and 
impact the scheduler thread. Recommended fix: avoid calling 
`updateJobStatus(RETRYING)` unless the current status is `RUNNING` (or make the 
transition idempotent), and/or broaden the catch to handle `RuntimeException` 
here with a safe fallback (e.g., log + keep current state or PAUSED depending 
on policy).
   ```suggestion
                       } catch (JobException | RuntimeException ex) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to