On a replica set, when a secondary is building multiple background indices on a given collection and that collection is dropped, the index builds may not be interrupted properly and the secondary may fail with an assertion error as follows:
2014-08-26T11:18:13.384-0400 [repl writer worker 1] Assertion: 17348:cannot dropAllIndexes when index builds in progress
In some rare cases, this issue may crash secondary nodes.
The affected collection and indices may not be successfully dropped on secondary nodes, so if one of these nodes later becomes primary, the collection and indices may still be present.
If a secondary node crashes, it needs to be restarted. If the secondary has become stale, it needs to be resynchronized by removing its data and performing an initial sync.
The workaround is to avoid the situation of multiple background index builds concurrent with collection drops:
- by making the indexes foreground builds, or
- by synchronizing collection drop with index build completion on secondaries through the use of write concern on the background index builds
MongoDB 2.6 production releases up to 2.6.4 are affected by this issue.
The fix is included in the 2.6.5 production release.
After an index build yields and regains its lock, check for interrupt before recovering our cursor.