title: Mongodb index state post crash and indexing stages
body: <p><strong>This question has two aspects, both related to indices.</strong> </p>
  
  <p>I have a dataset with 530 million entries, each entry has an array of 10 elements. I am using a single mongod. I am constructing an index on the array post-bulk-insert. The array has two key-value pairs of type string - int.</p>
  
  <p>I have already deduced/<a href="http://comments.gmane.org/gmane.comp.db.mongodb.user/52403" rel="nofollow">researched</a> that putting up the index before construction is what mongodb is designed for and such large datasets cannot be (post-insert) indexed without a massive amount of ram/swappable-virtual-memory.</p>
  
  <p><strong>one: phases of index construction</strong> </p>
  
  <p>What are the phases of index construction, I was looking at the log and saw it go up once from 0 to 100%, only to begin counting once it reached 100% (something to do with sorting ? ?). The second phase was MUCH slower then the first. Are there any more passes that need to be done ? </p>
  
  <p><strong>two: Index state</strong></p>
  
  <p>I wasn't going to watch the index construction at this rate, <em>and I have an indexed dataset as a backup</em>(which I can't trust anymore, keep reading). So, I <code>kill -9'd</code> the process. I started the process again, and the logs show the database acknowledging that a index build operation was in progress and ended incorrectly, but nothing beyond this. The index shows up in the <code>db.&lt;db-name&gt;.getIndexes()</code> list. </p>
  
  <p>I find this VERY odd especially the <code>getIndexes</code> bit, I know for a fact that index construction in this case never ended, and <em>now I can't trust the backups I have in which I believe indexing ended ok.</em> </p>
  
  <p>I at least expect a database platform to be in a consistent state, or to get to one before it passes me control. So, either rollback the index construction,finish it, or refuse to start without a recovery operation.</p>
  
  <p>So how do I find out if my database is in a consistant state, specifically the indices ? </p>