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

Need completion flag field in db.coll.getIndexes() output.

    • Type: Icon: New Feature New Feature
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Index Maintenance
    • Labels:
      None
    • Query

      When creating index as background,
      db.collection.getIndexes() shows the index even if it is in the middle of building.

      So this may lead to user misunderstanding that index creation is done.
      On primary user will wait for prompt of background index creation command, so on primary member this is no problem. But on secondary member, we have to check db.currentOp or mongodb log file.

      But users who doesn't know in detail, they might think index creation is done even during under creation. When user want to replace new index, some users may execute drop old index as soon as possible after building new index. But on secondary drop index command will executed before creating new index. This is nightmare to operators.

      db.collection.createIndex({keyword:1, _id:1}, {background:true})
      db.collection.dropIndex({keyword:1})
      

      So, I think it would be better that mongod server will show whether it is completed or building status on db.getIndexes() command. For example ..

      -- // During creating index on background
      > db.coll.getIndexes()
      [
      	...
      	{
      		"v" : 1,
      		"key" : {
      			"keyword" : 1,
      			"_id" : 1
      		},
      		"name" : "ix_keyword_id",
      		"ns" : "test.coll",
      		"background" : true,
      {color:red}		"building" : true{color}
      	}
      ]
      
      -- // After completion of index creation
      > db.coll.getIndexes()
      [
      	...
      	{
      		"v" : 1,
      		"key" : {
      			"keyword" : 1,
      			"_id" : 1
      		},
      		"name" : "ix_keyword_id",
      		"ns" : "test.coll",
      		"background" : true
      {color:red}		"building" : false{color}
      	}
      ]
      

      Thanks.

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            sunguck.lee@gmail.com 아나 하리
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: