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


##########
src/meta/meta_data.cpp:
##########
@@ -134,13 +134,16 @@ bool construct_replica(meta_view view, const gpid &pid, 
int max_replica_count)
     // we put max_replica_count-1 recent replicas to last_drops, in case of 
the DDD-state when the
     // only primary dead
     // when add node to pc.last_drops, we don't remove it from our cc.drop_list
-    CHECK(pc.hp_last_drops.empty(), "last_drops of partition({}) must be 
empty", pid);
+    std::vector<host_port> last_drops;
+    GET_HOST_PORTS(pc, last_drops, last_drops);
+    CHECK(last_drops.empty(), "last_drops of partition({}) must be empty", 
pid);
     for (auto iter = drop_list.rbegin(); iter != drop_list.rend(); ++iter) {
-        if (pc.hp_last_drops.size() + 1 >= max_replica_count) {
+        // hp_last_drops is added in the steps bellow.
+        if (last_drops.size() + 1 >= max_replica_count) {

Review Comment:
   if (pc.hp_last_drops.size() + 1 >= max_replica_count)
   The original implementation can be kept here. The preceding assertion 
guarantees that pc.hp_last_drops.size() is initially 0, so directly accessing 
hp_last_drops is safe. Later, the HEAD_INSERT_IP_AND_HOST_PORT_BY_DNS macro 
inserts the values synchronously, which avoids introducing more complex changes.



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