When background compaction is enabled (as shown here and here), one may hit the following invariant:
"expr":"_rsConfigState == kConfigReconfiguring","file":"src/mongo/db/repl/replication_coordinator_impl.cpp","line":4224
suganthi.mani@mongodb.com started to investigate the issue:
It seems like your change has exposed a bug in repl layer. Enabling the auto compaction as part of notifyReplRecoveryComplete (internally called by replSetInitiate cmd code path) , makes replSetInitiate cmd to take longer time to complete (few milliseconds) and that causes to race with stepup thread and leading to the invariant failure