Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32033

Allow dropIndex to succeed when index build is in progress

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • None
    • Execution Team 2020-03-09
    • 14

      Currently, if you try to drop an index while the index is being built, you receive the following error:

      shard-0:PRIMARY> db.bigStuff.dropIndex({x:1})
      {
      	"ok" : 0,
      	"errmsg" : "cannot perform operation: a background operation is currently running for collection randomStuff.bigStuff",
      	"code" : 12587,
      	"codeName" : "BackgroundOperationInProgressForNamespace"
      }
      

      This is confusing, and can be a problem for a user who regrets their decision to create the index and would like to cancel the request. The user can abort the index build by finding the operation in currentOp and then calling killOp. I am unclear if that leaves any index metadata in an inconsistent state, but, regardless, it's not an easy sequence for a distressed user to figure out in a hurry (especially in a sharded cluster). Users would benefit from the dropIndex command being able to do whatever is necessary to safely abort an in-progress index build.

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            cailin.nelson@mongodb.com Cailin Nelson (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: