@@ -79,7 +79,21 @@ inline bool is_member(const partition_configuration &pc, const rpc_address &node
79
79
inline bool is_partition_config_equal (const partition_configuration &pc1,
80
80
const partition_configuration &pc2)
81
81
{
82
- // secondaries no need to be same order
82
+ if (pc1.ballot != pc2.ballot || pc1.pid != pc2.pid ||
83
+ pc1.max_replica_count != pc2.max_replica_count ||
84
+ pc1.last_committed_decree != pc2.last_committed_decree ) {
85
+ return false ;
86
+ }
87
+
88
+ host_port pc1_primary;
89
+ GET_HOST_PORT (pc1, primary, pc1_primary);
90
+ host_port pc2_primary;
91
+ GET_HOST_PORT (pc2, primary, pc2_primary);
92
+ if (pc1_primary != pc2_primary) {
93
+ return false ;
94
+ }
95
+
96
+ // secondaries no need to be in the same order.
83
97
std::vector<host_port> pc1_secondaries;
84
98
GET_HOST_PORTS (pc1, secondaries, pc1_secondaries);
85
99
for (const auto &pc1_secondary : pc1_secondaries) {
@@ -88,17 +102,10 @@ inline bool is_partition_config_equal(const partition_configuration &pc1,
88
102
}
89
103
}
90
104
91
- // last_drops is not considered into equality check
92
- host_port pc1_primary;
93
- GET_HOST_PORT (pc1, primary, pc1_primary);
94
- host_port pc2_primary;
95
- GET_HOST_PORT (pc2, primary, pc2_primary);
96
105
std::vector<host_port> pc2_secondaries;
97
106
GET_HOST_PORTS (pc2, secondaries, pc2_secondaries);
98
- return pc1.ballot == pc2.ballot && pc1.pid == pc2.pid &&
99
- pc1.max_replica_count == pc2.max_replica_count && pc1_primary == pc2_primary &&
100
- pc1_secondaries.size () == pc2_secondaries.size () &&
101
- pc1.last_committed_decree == pc2.last_committed_decree ;
107
+ // last_drops is not considered into equality check
108
+ return pc1_secondaries.size () == pc2_secondaries.size ();
102
109
}
103
110
104
111
class replica_helper
0 commit comments