diff --git a/debezium-connector-mongodb/src/main/java/io/debezium/connector/mongodb/Replicator.java b/debezium-connector-mongodb/src/main/java/io/debezium/connector/mongodb/Replicator.java index ac8d5d450b0..8336dd4b4df 100644 --- a/debezium-connector-mongodb/src/main/java/io/debezium/connector/mongodb/Replicator.java +++ b/debezium-connector-mongodb/src/main/java/io/debezium/connector/mongodb/Replicator.java @@ -452,10 +452,9 @@ protected boolean handleOplogEvent(ServerAddress primaryAddress, Document event) ServerAddress serverAddress = address.get(); if (serverAddress != null && !serverAddress.equals(primaryAddress)) { - logger.info("Found new primary event in oplog, so stopping use of {} to continue with new primary", - primaryAddress); - // There is a new primary, so stop using this server and instead use the new primary ... - return false; + //primary switch will be handled automatically by mongo driver. + logger.info("Found new primary event in oplog, so stopping use of {} to continue with new primary {}", + primaryAddress, serverAddress); } else { logger.info("Found new primary event in oplog, current {} is new primary. " + "Continue to process oplog event.", primaryAddress);