limowang commented on code in PR #2328:
URL: 
https://github.com/apache/incubator-pegasus/pull/2328#discussion_r2882955412


##########
src/meta/meta_data.cpp:
##########
@@ -538,6 +541,11 @@ app_state::app_state(const app_info &info) : 
app_info(info), helpers(new app_sta
     CLEAR_IP_AND_HOST_PORT(pc, secondaries);
     CLEAR_IP_AND_HOST_PORT(pc, last_drops);
 
+    // TODO(yujingwei): use marco simplify the code, and the logical may should
+    // change
+    pc.__set_hp_secondaries({});

Review Comment:
   Since CLEAR_IP_AND_HOST_PORT(pc, secondaries) already performs the same 
steps internally, is there a reason to repeat them here?



##########
src/rpc/rpc_host_port.h:
##########
@@ -215,15 +215,18 @@ class TProtocol;
 // Head insert 'hp' and its DNS resolved rpc_address to the optional vector 
'hp_<field>' and vector
 // '<field>' of 'obj'. The types of the fields are std::vector<rpc_address> and
 // std::vector<host_port>, respectively.
-#define HEAD_INSERT_IP_AND_HOST_PORT_BY_DNS(obj, field, hp)                    
                    \
+#define HEAD_INSERT_IP_AND_HOST_PORT_BY_DNS(obj, field, hp, target)            
                    \

Review Comment:
   #define HEAD_INSERT_IP_AND_HOST_PORT_BY_DNS(obj, field, hp, target)          
                      \
       do {                                                                     
                      \
           auto &_obj = (obj);                                                  
                      \
           const auto &_hp = (hp);                                              
                      \
           auto &_target = (target);                                            
                      \
           _obj.field.insert(_obj.field.begin(), _hp.resolve());                
                      \
           if (!_obj.__isset.hp_##field) {                                      
                      \
               _obj.__set_hp_##field({});                                       
                      \
           }                                                                    
                      \
           _obj.hp_##field.insert(_obj.hp_##field.begin(), _hp);                
                      \
           _target = _obj.hp_##field;                                           
                      \
           DCHECK_EQ(_obj.field.size(), _obj.hp_##field.size());                
                      \
       } while (0)
   
   Would this revised macro definition make the logic clearer?



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