morningman commented on a change in pull request #7032:
URL: https://github.com/apache/incubator-doris/pull/7032#discussion_r749890518



##########
File path: be/src/agent/heartbeat_server.cpp
##########
@@ -78,6 +78,32 @@ void HeartbeatServer::heartbeat(THeartbeatResult& 
heartbeat_result,
 Status HeartbeatServer::_heartbeat(const TMasterInfo& master_info) {
     std::lock_guard<std::mutex> lk(_hb_mtx);
 
+    if (master_info.__isset.frontends_info) {
+        std::stringstream ss;
+        ss << "Heartbeat frontends info len: " << 
master_info.frontends_info.size();
+        for (auto info: master_info.frontends_info) {

Review comment:
       ```suggestion
           for (auto& info: master_info.frontends_info) {
   ```

##########
File path: be/src/agent/heartbeat_server.h
##########
@@ -34,9 +35,22 @@ class StorageEngine;
 class Status;
 class ThriftServer;
 
+struct FrontendStartInfo {
+    int64_t start_time;
+    bool is_alive;
+    DateTimeValue* last_heartbeat; // Invalid time of Info

Review comment:
       why not just use int64?

##########
File path: be/src/agent/heartbeat_server.cpp
##########
@@ -78,6 +78,32 @@ void HeartbeatServer::heartbeat(THeartbeatResult& 
heartbeat_result,
 Status HeartbeatServer::_heartbeat(const TMasterInfo& master_info) {
     std::lock_guard<std::mutex> lk(_hb_mtx);
 
+    if (master_info.__isset.frontends_info) {
+        std::stringstream ss;
+        ss << "Heartbeat frontends info len: " << 
master_info.frontends_info.size();
+        for (auto info: master_info.frontends_info) {
+            ss << "; host:" << info.network_address.hostname
+            << ", port:" << info.network_address.port
+            << ", fe_start_time:" << info.fe_start_time
+            << ", is_alive:" << info.is_alive;
+            std::string coord_addr_str = info.network_address.hostname + ":" + 
std::to_string(info.network_address.port);
+            auto fsi_ptr = 
_exec_env->frontends_start_time().find(coord_addr_str);
+            if (LIKELY(fsi_ptr != _exec_env->frontends_start_time().end())) {
+                fsi_ptr->second->is_alive = info.is_alive;

Review comment:
       Need lock to update




-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to