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

Allow dropIndex to succeed when index build is in progress

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Index Maintenance
    • Labels:
      None
    • Sprint:
      Execution Team 2020-03-09
    • Case:
    • Linked BF Score:
      14

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gregory.wlodarek Gregory Wlodarek
              Reporter:
              cailin.nelson Cailin Nelson
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: