If a last-stable binary version mongos attempts to point to a latest featureCompatibilityVersion sharded cluster, the mongos will spin, repeatedly attempting to connect and failing with IncompatibleServerVersion errors. Instead, the mongos should crash in this scenario. This framework should be available for all last-stable binary versions >= 3.8. This implementation should not cause a latest binary version mongos to crash upon attempting to connect to a last stable binary version node.
A proposed implementation for the framework follows:
The validateWireVersion function in protocol.cpp can be modified to have a new error code that is returned when the client's maximum wireVersion is less than the server's minimum wireVersion. If the client is a mongos and it sees this error upon calling validateWireVersion, it will crash. The client can use the isMongos() function to determine whether it is a mongos.This low-level implementation is justifiable because a last-stable mongos should crash upon any attempts to connect to a latest featureCompatibilityVersion node in the cluster. This implementation assumes a mongos will only be a client to other members of the same sharded cluster and not to members of a different sharded cluster.