Skip to content

Commit 42233d8

Browse files
committed
Fixes JAVA-6023, align log level to warning from error when removing the server from the cluster
1 parent 69a3c1d commit 42233d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

driver-core/src/main/com/mongodb/internal/connection/AbstractMultiServerCluster.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public void onChange(final ServerDescriptionChangedEvent event) {
231231

232232
private boolean handleReplicaSetMemberChanged(final ServerDescription newDescription) {
233233
if (!newDescription.isReplicaSetMember()) {
234-
LOGGER.error(format("Expecting replica set member, but found a %s. Removing %s from client view of cluster.",
234+
LOGGER.warn(format("Expecting replica set member, but found a %s. Removing %s from client view of cluster.",
235235
newDescription.getType(), newDescription.getAddress()));
236236
removeServer(newDescription.getAddress());
237237
return true;
@@ -247,7 +247,7 @@ private boolean handleReplicaSetMemberChanged(final ServerDescription newDescrip
247247
}
248248

249249
if (!replicaSetName.equals(newDescription.getSetName())) {
250-
LOGGER.error(format("Expecting replica set member from set '%s', but found one from set '%s'. "
250+
LOGGER.warn(format("Expecting replica set member from set '%s', but found one from set '%s'. "
251251
+ "Removing %s from client view of cluster.",
252252
replicaSetName, newDescription.getSetName(), newDescription.getAddress()));
253253
removeServer(newDescription.getAddress());
@@ -259,7 +259,7 @@ private boolean handleReplicaSetMemberChanged(final ServerDescription newDescrip
259259
if (newDescription.getCanonicalAddress() != null
260260
&& !newDescription.getAddress().equals(new ServerAddress(newDescription.getCanonicalAddress()))
261261
&& !newDescription.isPrimary()) {
262-
LOGGER.info(format("Canonical address %s does not match server address. Removing %s from client view of cluster",
262+
LOGGER.warn(format("Canonical address %s does not match server address. Removing %s from client view of cluster",
263263
newDescription.getCanonicalAddress(), newDescription.getAddress()));
264264
removeServer(newDescription.getAddress());
265265
return true;
@@ -342,7 +342,7 @@ private boolean isNotAlreadyPrimary(final ServerAddress address) {
342342

343343
private boolean handleShardRouterChanged(final ServerDescription newDescription) {
344344
if (!newDescription.isShardRouter()) {
345-
LOGGER.error(format("Expecting a %s, but found a %s. Removing %s from client view of cluster.",
345+
LOGGER.warn(format("Expecting a %s, but found a %s. Removing %s from client view of cluster.",
346346
SHARD_ROUTER, newDescription.getType(), newDescription.getAddress()));
347347
removeServer(newDescription.getAddress());
348348
}
@@ -351,7 +351,7 @@ private boolean handleShardRouterChanged(final ServerDescription newDescription)
351351

352352
private boolean handleStandAloneChanged(final ServerDescription newDescription) {
353353
if (getSettings().getHosts().size() > 1) {
354-
LOGGER.error(format("Expecting a single %s, but found more than one. Removing %s from client view of cluster.",
354+
LOGGER.warn(format("Expecting a single %s, but found more than one. Removing %s from client view of cluster.",
355355
STANDALONE, newDescription.getAddress()));
356356
clusterType = UNKNOWN;
357357
removeServer(newDescription.getAddress());

0 commit comments

Comments
 (0)