If an exception is hit in the init method, DocumentsWriter incorrectly
increments numDocsInRAM when in fact the document is not added.
Spinoff of this thread:
http://markmail.org/message/e76hgkgldxhakuaa
The root cause that led to the exception in init was actually due to
incorrect use of Lucene's APIs (one thread still modifying the
Document while IndexWriter.addDocument is adding it) but still we
should protect against any exceptions coming out of init.
added this method to IndexWriter:
boolean testPoint(String name)
Then in DocumentsWriter.ThreadState.init I added this:
assert writer.testPoint("DocumentsWriter.ThreadState.init start");
Then, tests can subclass IndexWriter and do interesting things at each
of these test points. We can add further test points over time...
Then I fixed the issue and the tests (& all tests) pass. I'll commit
in a day or two.