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

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

    XMLWordPrintable

    Details

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

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-query Backlog - Query Team (Inactive)
              Reporter:
              matt.lee Matt SeongUck Lee
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: