github-actions[bot] commented on code in PR #63918:
URL: https://github.com/apache/doris/pull/63918#discussion_r3332216669


##########
be/src/runtime/small_file_mgr.cpp:
##########
@@ -192,7 +189,32 @@ Status SmallFileMgr::_download_file(int64_t file_id, const 
std::string& md5,
         }
         return true;
     };
-    RETURN_IF_ERROR(client.execute(download_cb));
+
+    std::string url = "http://"; + host_port + query;
+    LOG(INFO) << "download file from: " << url;
+    HttpClient client;
+    RETURN_IF_ERROR(client.init(url));
+    Status execute_status = client.execute(download_cb);
+
+    if (!execute_status.ok()) {
+        rewind(fp.get());
+        if (ftruncate(fileno(fp.get()), 0) != 0) {
+            LOG(WARNING) << "fail to truncate temp file for https retry, 
errno=" << errno;
+        }
+        status = Status::OK();
+        digest = Md5Digest();
+
+        url = "https://"; + host_port + query;
+        LOG(INFO) << "HTTP failed, retrying with HTTPS: " << url;
+        HttpClient https_client;
+        RETURN_IF_ERROR(https_client.init(url));
+        // Skip TLS cert verification: internal cluster traffic only; file 
integrity
+        // is guaranteed independently by MD5 checksum verification below.

Review Comment:
   This fallback still builds the HTTPS URL from `master_fe_http_port`, but on 
this branch FE heartbeats populate that field from `Config.http_port` 
(`HeartbeatMgr.setMaster()` calls `tMasterInfo.setHttpPort(Config.http_port)`). 
In the stated HTTPS-only case (`enable_https=true`, `http_port=0`), the first 
request goes to `http://host:0/...` and this retry goes to 
`https://host:0/...`, so small-file download still fails. Please include the FE 
heartbeat change that sends `https_port` when HTTPS is enabled, or otherwise 
make BE use an actual HTTPS port before adding this fallback.



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