I think this problem originated from the work to allow dropDatabase to abort in-progress index builds before dropping the database itself.
Here is the sequence of events leading up to a fatal assertion in a build failure:
- The primary node runs dropDatabase on test.
- dropDatabase sets the dropPending flag to true.
- dropDatabase needs to abort any in-progress index builds on the collections belonging to it prior to dropping the database itself.
- dropDatabase waits until the index builds are aborted.
- The node steps down from primary to secondary.
- The nodes oplog application tries to create a collection on the test database but gets the DatabaseDropPending error, which is fatal during oplog application.
- is related to
SERVER-46560 Make Abort index build logic deterministic.
- related to
SERVER-46647 Stepping down the primary when running 'dropDatabase' can hit an invariant due to yielded locks
SERVER-46123 Make the dropDatabase command abort in-progress index builds