Note that there are some explanatory texts on larger screens.

plurals
  1. POClearing Locks between JUnit tests in Hibernate Search 4.1
    primarykey
    data
    text
    <p>we recently upgraded to Hibernate Search 4.1 and are getting errors when we run our JUnit tests based on the changes hibernate made with regards to locks. When we run Junit tests with the <em>AbstractTransactionalJUnit4SpringContextTests</em> we often see locks left after each test. In reviewing (<a href="https://stackoverflow.com/questions/9771127/how-to-handle-hibernate-search-index-recovery">How to handle Hibernate-Search index recovery</a>) we tried the native locks, but this did not resolve the issue.</p> <p>We've tried out the various locking mechanisms (simple, single, and native) using the default directory provider (Filestore) and regularly see messages like:</p> <pre><code>build 20-Apr-2012 07:07:53 ERROR 2012-04-20 07:07:53,290 154053 (LogErrorHandler.java:83) org.hibernate.search.exception.impl.LogErrorHandler - HSEARCH000058: HSEARCH000117: IOException on the IndexWriter build 20-Apr-2012 07:07:53 org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@target/indexes/Resource/write.lock build 20-Apr-2012 07:07:53 at org.apache.lucene.store.Lock.obtain(Lock.java:84) build 20-Apr-2012 07:07:53 at org.apache.lucene.index.IndexWriter.&lt;init&gt;(IndexWriter.java:1108) </code></pre> <p>or </p> <pre><code>build 19-Apr-2012 19:31:09 ERROR 2012-04-19 19:31:09,395 153552 (LuceneBackendTaskStreamer.java:61) org.hibernate.search.backend.impl.lucene.LuceneBackendTaskStreamer - HSEARCH000072: Couldn't open the IndexWriter because of previous error: operation skipped, index ouf of sync! </code></pre> <p>Some of these messages seem to show the lock issue cascading from one test to another, hence the need for the reset, and some may be valid because the tests are testing 'invalid' behaviors and how our application reacts to them, but often because of cases like this where the ID is null</p> <pre><code>build 19-Apr-2012 19:31:11 Primary Failure: build 19-Apr-2012 19:31:11 Entity org.tdar.core.bean.resource.CodingSheet Id null Work Type org.hibernate.search.backend.PurgeAllLuceneWork </code></pre> <p><em>But, regardless, we need to make sure that one test does not effect another.</em></p> <p>In reading some of the discussions (<a href="http://web.archiveorange.com/archive/v/SMVGgfuj2b0mPjjC2Hk1" rel="nofollow noreferrer">email discussion on directory providers</a>) it was suggested that the RAM based directory provider might be a better option, but we'd prefer to use the same provider as we use in production wherever possible.</p> <p>How should we be resetting HibernateSearch between tests to clean up lock files and reset potential issues where the index is out-of-sync or corrupted? At the beginning of the test suite, we wipe the index directory, is it recommended to wipe it after every test? </p> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload