diff --git a/lib/collection/src/shards/replica_set.rs b/lib/collection/src/shards/replica_set.rs index 5ed5300bd..849315bea 100644 --- a/lib/collection/src/shards/replica_set.rs +++ b/lib/collection/src/shards/replica_set.rs @@ -1311,8 +1311,8 @@ impl ShardReplicaSet { pub fn leader_peer_for_update(&self, ordering: WriteOrdering) -> Option { match ordering { WriteOrdering::Weak => Some(self.this_peer_id()), // no requirement for consistency - WriteOrdering::Medium => self.highest_replica_peer_id(), // consistency with highest replica - WriteOrdering::Strong => self.highest_alive_replica_peer_id(), // consistency with highest alive replica + WriteOrdering::Medium => self.highest_alive_replica_peer_id(), // consistency with highest alive replica + WriteOrdering::Strong => self.highest_replica_peer_id(), // consistency with highest replica } } diff --git a/tests/consensus_tests/test_write_ordering.py b/tests/consensus_tests/test_write_ordering.py index 03b3f319a..32bc540c6 100644 --- a/tests/consensus_tests/test_write_ordering.py +++ b/tests/consensus_tests/test_write_ordering.py @@ -60,15 +60,14 @@ def test_write_ordering(tmp_path: pathlib.Path): "id": 1, "vector": [0.05, 0.61, 0.76, 0.74], "payload": { - "city": "Dresden", + "city": "Munich", "country": "Germany", } } ] }) - - # fails as highest peer is dead - assert r.status_code == 500 + # succeeds as Medium selects an Alive peer + assert_http_ok(r) # write ordering strong r = requests.put( @@ -78,14 +77,15 @@ def test_write_ordering(tmp_path: pathlib.Path): "id": 1, "vector": [0.05, 0.61, 0.76, 0.74], "payload": { - "city": "Munich", + "city": "Dresden", "country": "Germany", } } ] }) - # succeeds as Strong selects an Alive peer - assert_http_ok(r) + + # fails as highest peer is dead + assert r.status_code == 500 # Restart peer new_url = start_peer(peer_dirs[url_index], f"peer_{url_index}_restarted.log", bootstrap_uri)