Query users of the external sorter ($group, $bucketAuto, etc) generate unique file names by incrementing a counter that starts at 0 on startup. When an unfinished index build is being resumed during startup, these temporary files are not cleared, and can result in queries spilling and re-using existing files.
If this happens, the following crash will occur:
We normally delete the "_tmp" directory at startup, however this will not happen if there are any index builds that need to be resumed after a clean shutdown:
There are few possible solutions:
- On startup, clear everything in the _tmp directory except for the sorter files needed for resumable index builds
- Provide an option to the external sorter to truncate new files before writing