-
Type:
Question
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance
-
None
-
None
-
0
-
None
-
None
-
None
-
None
-
None
-
None
I am facing such problem.
I do nightly aggregation jobs that are creating new data and push it to production replica set.
New data should completely replace currently available data.
To achieve that I push new data to new collection, say stage_my_collection, run indexing in background (to not disturb whole replicaset cluster since it is fully operational) as soon as indexing is done I do rename-drop to make collection available for our services:
db.stage_my_collection.renameCollection( "my_collection", true )
The services only read data from target collection but they read it from primary as well as slaves.
The problem is I do not have good mechanism to track indexing progress. db.collection.getIndexes() returns indexes as available even though indexing process is in progress.
As soon as primary node completes background indexing slaves starts it asynchronously.
To track progress I made a simple program that connects to each node in replicaset and checks current operation. But the information was misleading.
Then I tried to check the log output by issuing *
* on admin database.
That provides comprehensive information. So far so good.
But there is a problem.
The log entry contains current progress but does not have any information which index is building:
"2015-03-28T20:06:25.032+0000 [conn1858] \t\tIndex Build(background): 1981700/2071558\t95%",
"2015-03-28T20:06:28.022+0000 [conn1858] \t\tIndex Build(background): 1988600/2071558\t95%",
"2015-03-28T20:06:31.068+0000 [conn1858] \t\tIndex Build(background): 1994800/2071558\t96%",
"2015-03-28T20:06:34.045+0000 [conn1858] \t\tIndex Build(background): 2001200/2071558\t96%",
"2015-03-28T20:06:37.049+0000 [conn1858] \t\tIndex Build(background): 2006600/2071558\t96%",
"2015-03-28T20:06:40.016+0000 [conn1858] \t\tIndex Build(background): 2013100/2071558\t97%",
"2015-03-28T20:06:43.021+0000 [conn1858] \t\tIndex Build(background): 2021000/2071558\t97%",
"2015-03-28T20:06:55.004+0000 [conn1858] \t\tIndex Build(background): 2053400/2071558\t99%",
"2015-03-28T20:06:58.006+0000 [conn1858] \t\tIndex Build(background): 2067300/2071558\t99%",
"2015-03-28T20:06:58.823+0000 [conn1858] build index done. scanned 2071558 total records. 844.623 secs",
"2015-03-28T20:06:58.826+0000 [conn1858] command my_database.$cmd command: createIndexes { createIndexes: \"stage_my_collection\", indexes: [ { name: \"index_1_loc_2dsphere\", ns: \"my_database.stage_my_collection\", background: true, key:Unknown macro: { index}} ] } keyUpdates:0 numYields:7133 locks(micros) r:35 w:1643440483 reslen:113 844627ms",
But I do have fail signal if any:
"2015-03-28T19:26:23.301+0000 [conn1726] index build failed. spec: { v: 1, key:
Unknown macro: { index}, name: \"index_1_loc_2dsphere\", ns: \"my_database.stage_my_collection\", background: true, 2dsphereIndexVersion: 2 } error: 11601 operation was interrupted",
"2015-03-28T19:26:23.303+0000 [conn1726] command my_database.$cmd command: createIndexes { createIndexes: \"stage_my_collection\", indexes: [ { name: \"index_1_loc_2dsphere\", ns: \"my_database.stage_my_collection\", background: true, key:Unknown macro: { index}} ] } keyUpdates:0 numYields:16 locks(micros) r:50 w:3467543 reslen:140 1765ms",
Is there a better way for me to track indexing progress for each index?
Is it possible to add index uid (databaseName.collectionName.indexName) to the log output in future versions?