Skip to content

Commit 5a46ba9

Browse files
committed
CDRIVER-1564 never use PossiblePrimary for query
1 parent 70c36ac commit 5a46ba9

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ New features and bug fixes:
3737
* Added support for the new readConcernLevel "linearizable".
3838
* New CMake option ENABLE_TRACING allows debug output, which before had only
3939
been available with "configure --enable-tracing".
40+
* Bugfix: "PossiblePrimary"-type replicas could be selected for reads
4041

4142
Removed configure flags:
4243
* --enable-experimental has been removed and all of its features

src/mongoc/mongoc-topology-description.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ _mongoc_topology_description_server_is_candidate (
290290
switch ((int)read_mode) {
291291
case MONGOC_READ_PRIMARY:
292292
switch ((int)desc_type) {
293-
case MONGOC_SERVER_POSSIBLE_PRIMARY:
294293
case MONGOC_SERVER_RS_PRIMARY:
295294
return true;
296295
default:
@@ -305,7 +304,6 @@ _mongoc_topology_description_server_is_candidate (
305304
}
306305
default:
307306
switch ((int)desc_type) {
308-
case MONGOC_SERVER_POSSIBLE_PRIMARY:
309307
case MONGOC_SERVER_RS_PRIMARY:
310308
case MONGOC_SERVER_RS_SECONDARY:
311309
return true;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"in_latency_window": [],
3+
"operation": "read",
4+
"read_preference": {
5+
"mode": "Primary",
6+
"tag_sets": [
7+
{}
8+
]
9+
},
10+
"suitable_servers": [],
11+
"topology_description": {
12+
"servers": [
13+
{
14+
"address": "b:27017",
15+
"avg_rtt_ms": 5,
16+
"type": "PossiblePrimary"
17+
}
18+
],
19+
"type": "ReplicaSetNoPrimary"
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"in_latency_window": [],
3+
"operation": "read",
4+
"read_preference": {
5+
"mode": "Nearest",
6+
"tag_sets": [
7+
{}
8+
]
9+
},
10+
"suitable_servers": [],
11+
"topology_description": {
12+
"servers": [
13+
{
14+
"address": "b:27017",
15+
"avg_rtt_ms": 5,
16+
"type": "PossiblePrimary"
17+
}
18+
],
19+
"type": "ReplicaSetNoPrimary"
20+
}
21+
}

0 commit comments

Comments
 (0)