File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
driver-core/src/main/com/mongodb/internal/connection Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -252,11 +252,14 @@ private boolean handleReplicaSetMemberChanged(final ServerDescription newDescrip
252
252
}
253
253
254
254
if (newDescription .isPrimary ()) {
255
- if (isNonStalePrimary (newDescription .getElectionId (), newDescription .getSetVersion ())) {
256
- LOGGER .info (format ("Setting max election id to %s and max set version to %d from replica set primary %s" ,
257
- newDescription .getElectionId (), newDescription .getSetVersion (), newDescription .getAddress ()));
258
- maxElectionId = newDescription .getElectionId ();
259
- maxSetVersion = newDescription .getSetVersion ();
255
+ if (isNonStalePrimary (newDescription .getElectionId (), newDescription .getSetVersion ())) {
256
+ if (nullSafeCompareTo (newDescription .getElectionId (), maxElectionId ) != 0
257
+ || nullSafeCompareTo (newDescription .getSetVersion (), maxSetVersion ) != 0 ) {
258
+ LOGGER .info (format ("Setting max election id to %s and max set version to %d from replica set primary %s" ,
259
+ newDescription .getElectionId (), newDescription .getSetVersion (), newDescription .getAddress ()));
260
+ maxElectionId = newDescription .getElectionId ();
261
+ maxSetVersion = newDescription .getSetVersion ();
262
+ }
260
263
} else {
261
264
LOGGER .info (format ("Invalidating potential primary %s whose (set version, election id) tuple of (%d, %s) "
262
265
+ "is less than one already seen of (%d, %s)" ,
You can’t perform that action at this time.
0 commit comments