5/17/2023 0 Comments Apache lucene slow![]() your testing environment will not be exactly the same as your production environment anymore. ![]() It's super easy to implement, but there are a few disadvantages you should be aware of: Just for tests, do not store the indexes on the filesystem, but directly in the heap, by setting .type to local-heap (Hibernate Search 6 ) or _provider to local-heap (Hibernate Search 5 and below).In the case of Hibernate Search, you will have to find a way to use a different physical index in each test execution. Dedicated DB, or at least dedicated DB schema.If you really need to perform tests in parallel, I would recommend to execute each test in an isolated environment: This could lead to unpredictable results if your tests perform conflicting writes (one test erasing a document added by another test, before that test has completed). This means integration tests will probably compete for access to the exact same index, and will write to the same index. As far as I understand, you are trying to execute integration tests in parallel on the same machine. It is dangerous and probably will not behave as you want. ![]() I also tried already the property near-real-time and different lock factories as native, simple and single without luck.įirst: do not use exclusive_index_use unless you are a Lucene guru. Is it possible to use Spring Boot integration tests with Hibernate Search in a way so that locks are cleanly released between tests?Īlternativly I'm looking for a way to disable the Hibernate Search indexing for all integration tests not making use of Hibernate Search If I set exclusive_index_use to false, then it works without failure but then the test execution is very slow.įor me it seems the index is initialized during the startup of Spring Boot and interferes between the tests. LieferantEntity\write.lockĪt .NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:127) ~Īt .FSLockFactory.obtainLock(FSLockFactory.java:41) ~Īt .BaseDirectory.obtainLock(BaseDirectory.java:45) ~Īt .IndexWriter.(IndexWriter.java:776) ~Īt .(IndexWriterHolder.java:126) ~Īt .(IndexWriterHolder.java:92) ~Īt .(AbstractWorkspaceImpl.java:117) ~Īt .(AbstractWorkspaceImpl.java:203) ~Īt .(LuceneBackendQueueTask.java:81) Īt .(LuceneBackendQueueTask.java:46) Īt .$Consumer.appl圜hangesets(SyncWorkProcessor.java:165) Īt .$n(SyncWorkProcessor.java:151) Īt (Thread.java:745) LockObtainFailedException: Lock held by this virtual machine. Together with all other integration tests, every test class will throw an LockObtainFailedException and the Hibernate Search tests will fail. Spring Boot is starting and creates the index. If I run just this test class every things works fine. It works fine except of the integration tests. In my Spring Boot 1.5.10.Final project I use Hibernate Search ORM 5.6.4.Final.
0 Comments
Leave a Reply. |