- 
    Type:
Bug
 - 
    Resolution: Fixed
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: None
 - 
    Component/s: None
 - 
    None
 
- 
        Replication
 - 
        Fully Compatible
 - 
        ALL
 - 
        Repl 2024-08-19
 - 
        0
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
Post SERVER-79734, on restart, replset.startSet() will stepUp the first electable node as the new primary. As seen in BF-34320, this is causing "election failed" errors because by that time stepUp is called, the replset already ran an election and elected a new primary. More details in the linked bf. 
We should only trigger the stepUp on restart if the replset doesn't currently have a primary.
This test does a write after a restart, and in cases where restarting the first node in the set happens to take 10+ seconds and an election occurs on its own before restartSet() steps up a node that isn't already the primary, mongos can end up with an outdated view of the replica set's primary node, causing a subsequent non-retry able write to fail. Since this test is sensitive to unplanned elections, we should use a high election timeout to prevent those.