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

Flag noIndexBuildRetry doesn't clean up interrupted index

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.8.0-rc5
    • Fix Version/s: 3.0.0-rc9, 3.1.0
    • Component/s: Indexing
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Completed:
    • Sprint:
      RPL 0 3/13/15
    • Linked BF Score:
      0

      Description

      Start a mongod with --noIndexBuildRetry.

      Run the following script to build a index.

      var bulk = db.jstests_bgsec.initializeUnorderedBulkOp();
      for( i = 0; i < 100000; ++i ) {         bulk.insert({ i : i });     }
      assert.writeOK(bulk.execute());
       
      db.jstests_bgsec.ensureIndex( {i:1} );

      Kill mongod with signal 9. Restart mongod with --noIndexBuildRetry. The index is still in the index catalog, but not available for query.

      > db.jstests_bgsec.getIndexes()
      [
      	{
      		"v" : 1,
      		"key" : {
      			"_id" : 1
      		},
      		"name" : "_id_",
      		"ns" : "test.jstests_bgsec"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"i" : 1
      		},
      		"name" : "i_1",
      		"ns" : "test.jstests_bgsec",
      		"background" : true
      	}
      ]
       
      > db.jstests_bgsec.find({i: {$gt: -1}}).hint({i: 1}).explain()
      2015-01-15T17:23:21.955-0500 I QUERY    Error: explain failed: {
      	"ok" : 0,
      	"errmsg" : "error processing query: ns=test.jstests_bgsec limit=0 skip=0\nTree: i $gt -1.0\nSort: {}\nProj: {}\n planner returned error: bad hint",
      	"code" : 2
      }
          at Error (<anonymous>)
          at Function.throwOrReturn (src/mongo/shell/explainable.js:34:19)
          at constructor.finish (src/mongo/shell/explain_query.js:188:36)
          at DBQuery.explain (src/mongo/shell/query.js:434:25)
          at (shell):1:52 at src/mongo/shell/explainable.js:34
       
       
      > db.jstests_bgsec.stats()
      {
      	"ns" : "test.jstests_bgsec",
      	"count" : 100000,
      	"size" : 4800080,
      	"avgObjSize" : 48,
      	"numExtents" : 6,
      	"storageSize" : 11182080,
      	"lastExtentSize" : 8388608,
      	"paddingFactor" : 1,
      	"paddingFactorNote" : "paddingFactor is unused and unmaintained in 2.8. It remains hard coded to 1.0 for compatibility only.",
      	"userFlags" : 1,
      	"nindexes" : 1,
      	"indexDetails" : {
       
      	},
      	"totalIndexSize" : 3262224,
      	"indexSizes" : {
      		"_id_" : 3262224
      	},
      	"ok" : 1
      }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: