-
Type: New Feature
-
Resolution: Gone away
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance
-
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.
- is duplicated by
-
SERVER-32032 During index build, listIndexes should give some indication that build is in progress
- Closed
- is related to
-
SERVER-25175 listIndexes shouldn't include in-progress background index builds on primary nodes
- Closed