[SERVER-31090] Crash during collection compaction can drop indexes it intended to recreate. Created: 14/Sep/17 Updated: 06/Dec/22 Resolved: 14/Sep/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | MMAPv1, Storage |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Daniel Gottlieb (Inactive) | Assignee: | Backlog - Storage Execution Team |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Assigned Teams: |
Storage Execution
|
||||
| Operating System: | ALL | ||||
| Participants: | |||||
| Linked BF Score: | 65 | ||||
| Description |
|
The index drop is performed in a separate WriteUnitOfWork than their recreation on the catalog (part of `MultiIndexBlock::init`): Note how repairDatabase's index rebuild avoids this problem: https://github.com/mongodb/mongo/blob/5767ee2421fa6c7934a90e9083f07743a83dcf71/src/mongo/db/repair_database.cpp#L146-L150 It may be reasonable to have compact re-use the repairDatabase code for this. |
| Comments |
| Comment by Daniel Gottlieb (Inactive) [ 18/Sep/17 ] |
|
Hah! So we do. Nonetheless from what I can tell, `repairDatabase` is not prone to the same error. It would be beneficial to remove that scenario (by fixing having the logic mimic that of `repairDatabase` or removing the index rebuild component). |
| Comment by Eric Milkie [ 15/Sep/17 ] |
|
We can remove the index dropping from compact for doc-locking storage engines to fix this. |
| Comment by Asya Kamsky [ 14/Sep/17 ] |
|
We actually call that out in the docs: https://docs.mongodb.com/manual/reference/command/compact/index.html#operation-termination "You may have to manually rebuild the indexes." |