Closed mononym closed 2 years ago
need an appup.src file.
The logging put into place now gives errors like this:
=ERROR REPORT==== 8-Mar-2022::14:11:19.259530 ===
Configured mongo client topology does not match actual mongo install topology. Configured: replicaSetNoPrimary; Actual: standalone
=ERROR REPORT==== 8-Mar-2022::14:11:19.331212 ===
Configured mongo client topology does not match actual mongo install topology. Configured: sharded; Actual: standalone
mc_topology
Server now sends itself a message with a 1 second delay to init itself again, so if we do hit the deadloop because the server config changes in an incompatible way we will at least be caught in a slow loop rather than a tight one.
A deadloop is created when an invalid connection config, by specifying the wrong mongo_type and/or incorrect set names, is used to connect to a server/cluster. This happens because the
mc_topology
worker spawns themc_server
andmc_monitor
processes which end up triggering a method on themc_topology
gen server which kills themc_server
process when there is a mismatch between the config and what is returned from the connected server/cluster.However on receiving the
'EXIT'
message from the monitoredmc_server
process, themc_topology
worker instantly restarts it and the whole thing starts all over again. This is a very tight loop and will end up causing severe problems if not detected right away and currently it's not simple to detect that a misconfiguration is the cause.The only way to detect whether this is the cause would be to do the same check while the
mc_topology
worker is starting up which is what this code does. By doing this we can stop the connection call tomongo_api
ormongoc
from ever succeeding and return a meaningful error that can be used to indicate that the connection will never succeed as configured.With this code change a bad configuration will return an error that looks something like this:
{configured_mongo_type_mismatch,replicaSetNoPrimary,standalone}
Where the second value of the tuple is the type as defined in the connection configuration and the last value is what the Mongo server is configured as. A setName mismatch will return the following error:
{configured_mongo_set_name_mismatch, ConfigurationSetName, ServerSetName}
The checks added in the
mc_topology_logics
module should match all of the checks made higher up in the file in theupdate_topology_state
method that cause anexit
.