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

Dropping an index while another index getting created in the same collection is blocking reads in secondary

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.6.11
    • None
    • None
    • ALL
    • Hide

      Run the following on a collection which large number of docs(to feel the blocking manually):

      db.coll.ensureIndex({"field1":1,"field2" : 1},{"background" : true})
      db.coll.dropIndex({"field1_1"},{"background" : true})   // assume index {"field1" : 1} is already present
      

      Now once the ensureIndex is completed in primary dropIndex will run immediately.
      While the ensureIndex is running in the secondary run any query it will be blocked till the ensureIndex and the dropIndex are replicated.

      Show
      Run the following on a collection which large number of docs(to feel the blocking manually): db.coll.ensureIndex({"field1":1,"field2" : 1},{"background" : true}) db.coll.dropIndex({"field1_1"},{"background" : true}) // assume index {"field1" : 1} is already present Now once the ensureIndex is completed in primary dropIndex will run immediately. While the ensureIndex is running in the secondary run any query it will be blocked till the ensureIndex and the dropIndex are replicated.

    Description

      Dropping an index in primary while an index creation is replicating in the secondary is blocking all read and write operation on the database.

      Logs from secondary:

      2016-08-29T05:23:54.991+0000 [repl index builder 22] build index on: <ns> properties: { v: 1, key: { <keys> }, name: "<name>", ns: "<ns>", background: true }
      2016-08-29T05:23:54.991+0000 [repl index builder 22]     building index in background
      2016-08-29T05:23:55.001+0000 [repl writer worker 3] CMD: dropIndexes <ns>
      2016-08-29T05:23:57.002+0000 [repl index builder 22]            Index Build(background): 242700/1705097 14%
      2016-08-29T05:24:00.002+0000 [repl index builder 22]            Index Build(background): 559300/1705097 32%
      2016-08-29T05:24:03.002+0000 [repl index builder 22]            Index Build(background): 855500/1705097 50%
      2016-08-29T05:24:06.002+0000 [repl index builder 22]            Index Build(background): 1174800/1705097        68%
      2016-08-29T05:24:09.002+0000 [repl index builder 22]            Index Build(background): 1447900/1705097        84%
      2016-08-29T05:24:12.002+0000 [repl index builder 22]            Index Build(background): 1700900/1705097        99%
      2016-08-29T05:24:12.050+0000 [repl index builder 22] build index done.  scanned 1705097 total records. 17.058 secs
      2016-08-29T05:24:12.051+0000 [repl writer worker 3] CMD: dropIndexes <ns>
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vivek_jonam Manoj Vivek
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: