Index builds spill to temporary data files via the external sorter. On clean shutdown, we persist state that allows us to resume the index build on restart. While the storage engine fsyncs its files to disk, it does not appear that we ever fsync the sorter files. It is therefore possible for us to lose data if the database operator performs a hard reset of a machine after a clean shutdown of the database.
If we fail to persist anything correctly, we will detect that and fail with an assertion eventually before completing the index.
This affects all versions back to 5.0.