gavinchou commented on code in PR #54445:
URL: https://github.com/apache/doris/pull/54445#discussion_r2259592229


##########
be/src/cloud/cloud_warm_up_manager.cpp:
##########
@@ -490,93 +498,111 @@ std::vector<TReplicaInfo> 
CloudWarmUpManager::get_replica_info(int64_t tablet_id
 }
 
 void CloudWarmUpManager::warm_up_rowset(RowsetMeta& rs_meta) {
-    auto replicas = get_replica_info(rs_meta.tablet_id());
-    if (replicas.empty()) {
-        LOG(INFO) << "There is no need to warmup tablet=" << 
rs_meta.tablet_id()
-                  << ", skipping rowset=" << rs_meta.rowset_id().to_string();
-        return;
-    }
-    int64_t now_ts = std::chrono::duration_cast<std::chrono::microseconds>(
-                             
std::chrono::system_clock::now().time_since_epoch())
-                             .count();
-    g_file_cache_warm_up_rowset_last_call_unix_ts.set_value(now_ts);
-
-    PWarmUpRowsetRequest request;
-    request.add_rowset_metas()->CopyFrom(rs_meta.get_rowset_pb());
-    request.set_unix_ts_us(now_ts);
-    for (auto& replica : replicas) {
-        // send sync request
-        std::string host = replica.host;
-        auto dns_cache = ExecEnv::GetInstance()->dns_cache();
-        if (dns_cache == nullptr) {
-            LOG(WARNING) << "DNS cache is not initialized, skipping hostname 
resolve";
-        } else if (!is_valid_ip(replica.host)) {
-            Status status = dns_cache->get(replica.host, &host);
-            if (!status.ok()) {
-                LOG(WARNING) << "failed to get ip from host " << replica.host 
<< ": "
-                             << status.to_string();
-                return;
-            }
-        }
-        std::string brpc_addr = get_host_port(host, replica.brpc_port);
-        Status st = Status::OK();
-        std::shared_ptr<PBackendService_Stub> brpc_stub =
-                
ExecEnv::GetInstance()->brpc_internal_client_cache()->get_new_client_no_cache(
-                        brpc_addr);
-        if (!brpc_stub) {
-            st = Status::RpcError("Address {} is wrong", brpc_addr);
-            continue;
+    bool refresh = false;
+    bool retry = false;
+    do {
+        refresh = retry;
+        retry = false;
+        auto replicas = get_replica_info(rs_meta.tablet_id(), refresh);
+        if (replicas.empty()) {
+            LOG(INFO) << "There is no need to warmup tablet=" << 
rs_meta.tablet_id()
+                      << ", skipping rowset=" << 
rs_meta.rowset_id().to_string();
+            return;
         }
+        int64_t now_ts = std::chrono::duration_cast<std::chrono::microseconds>(
+                                 
std::chrono::system_clock::now().time_since_epoch())
+                                 .count();
+        g_file_cache_warm_up_rowset_last_call_unix_ts.set_value(now_ts);
+
+        PWarmUpRowsetRequest request;
+        request.add_rowset_metas()->CopyFrom(rs_meta.get_rowset_pb());
+        request.set_unix_ts_us(now_ts);
+        request.set_force(refresh);
+        for (auto& replica : replicas) {
+            // send sync request
+            std::string host = replica.host;
+            auto dns_cache = ExecEnv::GetInstance()->dns_cache();

Review Comment:
   dns cache, client 这种逻辑是可以封装成小的在这个编译单元的 小函数的函数的



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