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


##########
regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy:
##########
@@ -683,6 +695,20 @@ class SuiteCluster {
         waitHbChanged()
     }
 
+    // indices start from 1, not 0
+    // if not specific be indices, then stop all meta services
+    void stopMetaServices(int... indices) {
+        runMsCmd(STOP_WAIT_TIMEOUT + 5, "stop --wait-timeout 
${STOP_WAIT_TIMEOUT}".toString(), indices)
+        waitHbChanged()
+    }
+
+    // indices start from 1, not 0
+    // if not specific be indices, then stop all recyclers

Review Comment:
   `stopMetaServices(...)`/`stopRecyclers(...)` comments refer to “be indices”, 
but these methods operate on meta services / recyclers. Updating these copied 
comments will help avoid using the wrong indices when writing regression suites.
   ```suggestion
       // if not specific meta service indices, then stop all meta services
       void stopMetaServices(int... indices) {
           runMsCmd(STOP_WAIT_TIMEOUT + 5, "stop --wait-timeout 
${STOP_WAIT_TIMEOUT}".toString(), indices)
           waitHbChanged()
       }
   
       // indices start from 1, not 0
       // if not specific recycler indices, then stop all recyclers
   ```



##########
regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy:
##########
@@ -669,6 +669,18 @@ class SuiteCluster {
         runBackendsCmd(START_WAIT_TIMEOUT + 5, "start  --wait-timeout 
${START_WAIT_TIMEOUT}".toString(), indices)
     }
 
+    // indices start from 1, not 0
+    // if not specific fe indices, then start all meta services
+    void startMetaServices(int... indices) {
+        runMsCmd(START_WAIT_TIMEOUT + 5, "start  --wait-timeout 
${START_WAIT_TIMEOUT}".toString(), indices)
+    }
+
+    // indices start from 1, not 0
+    // if not specific fe indices, then start all recyclers

Review Comment:
   The new start/stop helpers for meta services use names/comments that are 
inconsistent with the existing API in this class (e.g. existing 
`restartMs(...)` vs new `startMetaServices/stopMetaServices`). Also the 
comments mention “fe indices”/“be indices” but these methods take 
meta-service/recycler indices. Consider renaming to match the established `*Ms` 
naming (or aligning the existing method) and fix the copied comments to avoid 
confusion for suite authors.
   ```suggestion
       // if not specific meta-service indices, then start all meta services
       void startMs(int... indices) {
           runMsCmd(START_WAIT_TIMEOUT + 5, "start  --wait-timeout 
${START_WAIT_TIMEOUT}".toString(), indices)
       }
   
       // Backward-compatible alias for suite code that still uses the longer 
name.
       void startMetaServices(int... indices) {
           startMs(indices)
       }
   
       // indices start from 1, not 0
       // if not specific recycler indices, then start all recyclers
   ```



##########
docker/runtime/doris-compose/resource/init_fe.sh:
##########
@@ -166,9 +166,24 @@ register_sql_server_cluster() {
 }
 
 start_cloud_fe() {
-    if [ -f "$REGISTER_FILE" ] || [ -n "${CLUSTER_SNAPSHOT_FILE}" ]; then
+    RECOVERY_SCRIPT="${DORIS_HOME}/conf/restore_snapshot.sh"
+    RECOVERY_ARGS=""
+    if [ -f "$RECOVERY_SCRIPT" ]; then
+        JOURNAL_ID=$(grep '^JOURNAL_ID=' "$RECOVERY_SCRIPT" | head -1 | cut 
-d= -f2)
+        if [ -z "$JOURNAL_ID" ]; then
+            health_log "ERROR: Could not extract JOURNAL_ID from recovery 
script"
+            exit 1
+        fi
+        health_log "Found recovery script with JOURNAL_ID=$JOURNAL_ID, 
executing..."
+        bash "$RECOVERY_SCRIPT"
+        mv "$RECOVERY_SCRIPT" "${RECOVERY_SCRIPT}.bak"

Review Comment:
   The recovery-script path is executed and then immediately renamed to `.bak` 
without checking the script’s exit status. If `restore_snapshot.sh` fails, this 
will both hide the failure and prevent retry on the next container start, and 
then proceed to start FE with recovery flags against an un-restored meta dir. 
Capture the exit code and only rename the script / continue startup when the 
restore succeeds; otherwise log the failure and exit non-zero.
   ```suggestion
           bash "$RECOVERY_SCRIPT"
           RECOVERY_RES=$?
           if [ $RECOVERY_RES -ne 0 ]; then
               health_log "ERROR: Recovery script failed with exit code 
$RECOVERY_RES"
               exit $RECOVERY_RES
           fi
           mv "$RECOVERY_SCRIPT" "${RECOVERY_SCRIPT}.bak"
           MV_RES=$?
           if [ $MV_RES -ne 0 ]; then
               health_log "ERROR: Failed to rename recovery script to 
${RECOVERY_SCRIPT}.bak"
               exit $MV_RES
           fi
   ```



-- 
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