It's possible for us to enter a state where _shouldSetStableTimestamp inadvertently gets set to false forever. This can only happen if the client incorrectly used replSetInitiate, but the side effects can cause us to never set the stableTimestamp, even if we are a healthy secondary.
This code is specific to eMRC=false, so we can remove the code in 5.0+ but will have to backport a different fix to previous versions.
This case should be reproducible with eMRC=false by:
- Starting a new node and running replSetInitiate with an invalid config, which would fail processReplSetInitiate after setting _shouldSetStableTimestamp to false.
- Add this node to an existing cluster. After going through initial sync, we should observe that this new node never advances its stableTS.
- If we restart the node, we should observe that it enters initial sync again.