|
I put up a quite detailed patch here with much of the necessary logic, most of which is covered in the design. The complete logic is as follows:
- If a startIndexBuild entry is rolled back:
- If the index build is active, kill it
- (missing from my patch): If the index build is in the set of "indexBuildsToRestart", remove it to prevent it from being restarted. Skip the next step, since the index will already be in the "indexesToDrop" set.
- If no index build is active, add it to the set of "indexesToDrop"
- If an abortIndexBuild entry is rolled back:
- (missing from my patch) Add it to the set of "indexesToDrop", which will be dropped before any indexes are restarted.
- Add it to the set of "indexBuildsToRestart", which will restart the index build in the background, but not commit it before rollback completes
- If a dropIndexes entry is rolled back:
- Add it to the set of "indexesToCreate", which will build the index build in the foreground and commit it.
- If a commitIndexBuild entry is rolled back:
- If any of the indexes are in the set of "indexesToCreate", remove them, since the index cannot be committed.
- (missing from my patch) Add it to the set of "indexesToDrop", which will be dropped before any indexes are restarted.
- Add it to the set of "indexBuildsToRestart", which will restart the index build in the background, but not commit it before rollback completes
|