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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new eb208f04245 branch-4.1: [fix](regression) Handle loopback export hosts 
locally #65444 (#65650)
eb208f04245 is described below

commit eb208f04245c053c529f71481cbb2d11b73f4cbd
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jul 16 10:57:36 2026 +0800

    branch-4.1: [fix](regression) Handle loopback export hosts locally #65444 
(#65650)
    
    Cherry-picked from #65444
    
    Co-authored-by: shuke <[email protected]>
---
 .../regression/util/RemoteFileOperator.groovy      | 32 ++++++++++++++++------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/RemoteFileOperator.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/RemoteFileOperator.groovy
index 13f404f928d..585b387bd00 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/RemoteFileOperator.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/RemoteFileOperator.groovy
@@ -100,7 +100,7 @@ class RemoteFileOperator {
             }
             
             if (execResult.exitCode != 0) {
-                def errorMsg = "Failed to create directory on ${host} (exit 
code: ${execResult.exitCode}): ${execResult.error}"
+                def errorMsg = "Failed to create directory on ${host} (exit 
code: ${execResult.exitCode}): ${execResult.stderr}"
                 logger.error(errorMsg)
                 throw new Exception(errorMsg)
             }
@@ -140,7 +140,9 @@ class RemoteFileOperator {
         hosts.each { host ->
             // Step 1: Check if remote directory has files (count regular 
files only)
             // scp user@host:/tmp/doristest/* will fail if doristest has no 
files.
-            String countCommand = """ssh -p ${port} ${username}@${host} "find 
${escapePath(remoteDir)} -maxdepth 1 -type f | wc -l" """
+            String countCommand = isLocalHost(host)
+                    ? "find ${escapePath(remoteDir)} -maxdepth 1 -type f | wc 
-l"
+                    : """ssh -p ${port} ${username}@${host} "find 
${escapePath(remoteDir)} -maxdepth 1 -type f | wc -l" """
             def countResult = executeLocalCommand(countCommand)
             
             if (countResult.timedOut) {
@@ -150,7 +152,7 @@ class RemoteFileOperator {
             }
             
             if (countResult.exitCode != 0) {
-                def errorMsg = "Failed to check file count on ${host} (exit 
code: ${countResult.exitCode}): ${countResult.error}"
+                def errorMsg = "Failed to check file count on ${host} (exit 
code: ${countResult.exitCode}): ${countResult.stderr}"
                 logger.error(errorMsg)
                 throw new Exception(errorMsg)
             }
@@ -163,9 +165,16 @@ class RemoteFileOperator {
             if (fileCount > 0) {
                 logger.info("Downloading ${fileCount} files from 
${host}:${remoteDir} to ${localBaseDir}")
 
-                def normalizedRemoteDir = (remoteDir.endsWith('/') ? remoteDir 
: "${remoteDir}/") + "*"
-                def scpCommand = "scp -P ${port} 
${username}@${host}:${escapePath(normalizedRemoteDir)} 
${escapePath(localBaseDir)}"
-                def execResult = executeLocalCommand(scpCommand)
+                def copyCommand
+                if (isLocalHost(host)) {
+                    copyCommand = "find ${escapePath(remoteDir)} -maxdepth 1 
-type f " +
+                            "-exec cp -f '{}' ${escapePath(localBaseDir)} ';'"
+                } else {
+                    def normalizedRemoteDir = (remoteDir.endsWith('/') ? 
remoteDir : "${remoteDir}/") + "*"
+                    copyCommand = "scp -P ${port} 
${username}@${host}:${escapePath(normalizedRemoteDir)} " +
+                            escapePath(localBaseDir)
+                }
+                def execResult = executeLocalCommand(copyCommand)
 
                 if (execResult.timedOut) {
                     def errorMsg = "Timeout downloading from ${host} 
(${timeout}ms)"
@@ -174,7 +183,7 @@ class RemoteFileOperator {
                 }
 
                 if (execResult.exitCode != 0) {
-                    def errorMsg = "Failed to download from ${host} (exit 
code: ${execResult.exitCode}): ${execResult.error}"
+                    def errorMsg = "Failed to download from ${host} (exit 
code: ${execResult.exitCode}): ${execResult.stderr}"
                     logger.error(errorMsg)
                     throw new Exception(errorMsg)
                 }
@@ -214,7 +223,7 @@ class RemoteFileOperator {
             }
             
             if (execResult.exitCode != 0) {
-                def errorMsg = "Failed to delete directory on ${host} (exit 
code: ${execResult.exitCode}): ${execResult.error}"
+                def errorMsg = "Failed to delete directory on ${host} (exit 
code: ${execResult.exitCode}): ${execResult.stderr}"
                 logger.error(errorMsg)
                 throw new Exception(errorMsg)
             }
@@ -224,10 +233,17 @@ class RemoteFileOperator {
     }
 
     private Map executeSshCommand(String host, String command) {
+        if (isLocalHost(host)) {
+            return executeLocalCommand(command)
+        }
         def sshCommand = "ssh -p ${port} ${username}@${host} '${command}'"
         return executeLocalCommand(sshCommand)
     }
 
+    private boolean isLocalHost(String host) {
+        return host in ["127.0.0.1", "localhost", "::1"]
+    }
+
     private Map executeLocalCommand(String command) {
         def result = [
             exitCode: -1,


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

Reply via email to