On 5/26/2014 10:57 AM, Furkan KAMACI wrote: > Hi; > > I run Solr within my Test Suite. I delete documents or atomically update > them and check whether if it works or not. I know that I have to setup a > hard/soft commit timing for my test Solr. However even I have that settings: > > <autoCommit> > <maxTime>1</maxTime> > <openSearcher>true</openSearcher> > </autoCommit> > > <autoSoftCommit> > <maxTime>1</maxTime> > </autoSoftCommit>
I hope you know that this is BAD configuration. Doing automatic commits on an interval of 1 millisecond is asking for a whole host of problems. In some cases, this could do a commit after every single document that is indexed, which is NOT recommended at all. The openSearcher setting of "true" on autoCommit makes it even worse. There's no reason to do both autoSoftCommit and autoCommit with openSearcher=true. I don't know which one "wins" between autoCommit and autoSoftCommit if they both have the same config, but I would guess the hard commit does. > and even I wait (Thread.sleep()) for a time to wait Solr *sometimes* my > tests are failed. I get fail error even I increase wait time. Example of a > sometimes failed code piece: > > for (int i = 0; i < dummyDocumentSize; i++) { > deleteById("id" + i); > dummyDocumentSize--; > queryResponse = query(solrParams); > assertTrue(queryResponse.getResults().size() == dummyDocumentSize); > } > > at debug mode if I wait for Solr to reflect changes I see that I do not get > error. What do you think, what kind of configuration I should have for such > kind of purposes? Chances are that commits are going to take longer than 1 millisecond. If you're actively indexing, the system is going to be trying to stack up lots of commits at the same time. The maxWarmingSearchers value will limit the number of new searchers that can be opened, but it will not stop the commits themselves. When lots of commits are going on, each one will take *even longer* to complete, which probably explains the problem. Thanks, Shawn