Building indexes concurrently can lead to a corrupt index catalog. In particular, the order of operations that expose this bug is:
- Start a background index build
- Start another index build (background or foreground)
- After the second index build completes, kill the background index build with db.killOp()
After this series of steps, the index catalog is corrupted and changes to the data in this collection or a call to stats() results in an error.
A node ending up with a corrupt index catalog needs to be repaired or resynced from a healthy node.
The index position of the background index needs to be re-calculated on failure as it may have changed. This allows the server to clean up the failed index build correctly.
It is advisable to build indexes one at a time, not concurrently.
All recent production release versions up to 2.4.9 are affected. The 2.6 series is unaffected.
The fix is included in the 2.4.10 production release.