[SERVER-30224] Need completion flag field in db.coll.getIndexes() output. Created: 19/Jul/17  Updated: 27/Oct/23  Resolved: 30/Nov/17

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: 아나 하리 Assignee: Backlog - Query Team (Inactive)
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-32032 During index build, listIndexes shoul... Closed
Related
is related to SERVER-25175 listIndexes shouldn't include in-prog... Closed
Assigned Teams:
Query
Participants:

 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.



 Comments   
Comment by Eric Milkie [ 30/Nov/17 ]

As of SERVER-25175, the listIndexes command no longer shows non-ready indexes.

Comment by Eric Milkie [ 19/Nov/17 ]

We are in fact already making that behavior change in SERVER-25175.

Comment by Asya Kamsky [ 21/Jul/17 ]

Would it be more correct for db.collection.getIndexes() not to show the index that is in process of being built (so it would only show up once it's built)

Comment by Kelsey Schubert [ 19/Jul/17 ]

Hi matt.lee,

Thank you for the feature request. I've sent it to the Query Team for consideration. Please continue tot watch for updates.

Kind regards,
Thomas

Generated at Thu Feb 08 04:23:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.