File tree 2 files changed +79
-1
lines changed
main/com/mongodb/internal/connection
test/resources/server-discovery-and-monitoring/rs
2 files changed +79
-1
lines changed Original file line number Diff line number Diff line change @@ -261,7 +261,8 @@ private boolean handleReplicaSetMemberChanged(final ServerDescription newDescrip
261
261
ensureServers (newDescription );
262
262
263
263
if (newDescription .getCanonicalAddress () != null
264
- && !newDescription .getAddress ().equals (new ServerAddress (newDescription .getCanonicalAddress ()))) {
264
+ && !newDescription .getAddress ().equals (new ServerAddress (newDescription .getCanonicalAddress ()))
265
+ && !newDescription .isPrimary ()) {
265
266
if (LOGGER .isInfoEnabled ()) {
266
267
LOGGER .info (format ("Canonical address %s does not match server address. Removing %s from client view of cluster" ,
267
268
newDescription .getCanonicalAddress (), newDescription .getAddress ()));
Original file line number Diff line number Diff line change
1
+ {
2
+ "description" : " Primary mismatched me is not removed" ,
3
+ "uri" : " mongodb://localhost:27017,localhost:27018/?replicaSet=rs" ,
4
+ "phases" : [
5
+ {
6
+ "responses" : [
7
+ [
8
+ " localhost:27017" ,
9
+ {
10
+ "ok" : 1 ,
11
+ "hosts" : [
12
+ " localhost:27017" ,
13
+ " localhost:27018"
14
+ ],
15
+ "ismaster" : true ,
16
+ "setName" : " rs" ,
17
+ "primary" : " localhost:27017" ,
18
+ "me" : " a:27017" ,
19
+ "minWireVersion" : 0 ,
20
+ "maxWireVersion" : 7
21
+ }
22
+ ]
23
+ ],
24
+ "outcome" : {
25
+ "servers" : {
26
+ "localhost:27017" : {
27
+ "type" : " RSPrimary" ,
28
+ "setName" : " rs"
29
+ },
30
+ "localhost:27018" : {
31
+ "type" : " Unknown" ,
32
+ "setName" : null
33
+ }
34
+ },
35
+ "topologyType" : " ReplicaSetWithPrimary" ,
36
+ "logicalSessionTimeoutMinutes" : null ,
37
+ "setName" : " rs"
38
+ }
39
+ },
40
+ {
41
+ "responses" : [
42
+ [
43
+ " localhost:27018" ,
44
+ {
45
+ "ok" : 1 ,
46
+ "hosts" : [
47
+ " localhost:27017" ,
48
+ " localhost:27018"
49
+ ],
50
+ "ismaster" : false ,
51
+ "secondary" : true ,
52
+ "setName" : " rs" ,
53
+ "primary" : " localhost:27017" ,
54
+ "me" : " localhost:27018" ,
55
+ "minWireVersion" : 0 ,
56
+ "maxWireVersion" : 7
57
+ }
58
+ ]
59
+ ],
60
+ "outcome" : {
61
+ "servers" : {
62
+ "localhost:27017" : {
63
+ "type" : " RSPrimary" ,
64
+ "setName" : " rs"
65
+ },
66
+ "localhost:27018" : {
67
+ "type" : " RSSecondary" ,
68
+ "setName" : " rs"
69
+ }
70
+ },
71
+ "topologyType" : " ReplicaSetWithPrimary" ,
72
+ "logicalSessionTimeoutMinutes" : null ,
73
+ "setName" : " rs"
74
+ }
75
+ }
76
+ ]
77
+ }
You can’t perform that action at this time.
0 commit comments