Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2782

Query on the cache with Invalidation mode fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 5.2.0.Final
    • Embedded Querying
    • None

      Assume that we have 2 nodes. node1 contains data entries, node2 doesn't.

      When configuring cache in the following way:

      ConfigurationBuilder cacheCfg = getDefaultClusteredCacheConfig(CacheMode.INVALIDATION_SYNC, false);
            cacheCfg.indexing()
                  .enable()
                  .indexLocalOnly(true)
                  .addProperty("default.directory_provider", "infinispan")
                  .addProperty("default.indexmanager", "org.infinispan.query.indexmanager.InfinispanIndexManager")
                  .addProperty("lucene_version", "LUCENE_CURRENT")
                  .addProperty("default.exclusive_index_use", "false");
            List<Cache<String, Person>> caches = createClusteredCaches(2, cacheCfg);
      

      And running query on node1 cache, the following exception appears:

      org.hibernate.search.SearchException: Unable to reopen IndexReader
      	at org.hibernate.search.indexes.impl.SharingBufferReaderProvider$PerDirectoryLatestReader.refreshAndGet(SharingBufferReaderProvider.java:253)
      	at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.openIndexReader(SharingBufferReaderProvider.java:85)
      	at org.hibernate.search.reader.impl.MultiReaderFactory.openReader(MultiReaderFactory.java:49)
      	at org.hibernate.search.query.engine.impl.HSQueryImpl.buildSearcher(HSQueryImpl.java:612)
      	at org.hibernate.search.query.engine.impl.HSQueryImpl.buildSearcher(HSQueryImpl.java:511)
      	at org.hibernate.search.query.engine.impl.HSQueryImpl.queryEntityInfos(HSQueryImpl.java:249)
      	at org.infinispan.query.impl.CacheQueryImpl.list(CacheQueryImpl.java:170)
      	at org.infinispan.query.blackbox.ClusteredInvalidationCacheTest.testSimple(ClusteredInvalidationCacheTest.java:126)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
      	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      	at org.testng.TestRunner.privateRun(TestRunner.java:767)
      	at org.testng.TestRunner.run(TestRunner.java:617)
      	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
      	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
      	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
      	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
      	at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
      	at org.testng.TestNG.run(TestNG.java:1031)
      	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
      	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
      	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
      	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:111)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: org.apache.lucene.index.IndexNotFoundException: no segments* file found in InfinispanDirectory{indexName='person'}: files: []
      	at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:667)
      	at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:554)
      	at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:359)
      	at org.apache.lucene.index.SegmentInfos.readCurrentVersion(SegmentInfos.java:483)
      	at org.apache.lucene.index.DirectoryReader.isCurrent(DirectoryReader.java:891)
      	at org.apache.lucene.index.DirectoryReader.doOpenNoWriter(DirectoryReader.java:455)
      	at org.apache.lucene.index.DirectoryReader.doOpenIfChanged(DirectoryReader.java:434)
      	at org.apache.lucene.index.DirectoryReader.doOpenIfChanged(DirectoryReader.java:375)
      	at org.apache.lucene.index.IndexReader.openIfChanged(IndexReader.java:508)
      	at org.hibernate.search.indexes.impl.SharingBufferReaderProvider$PerDirectoryLatestReader.refreshAndGet(SharingBufferReaderProvider.java:250)
      	... 37 more
      

      Additionally, in case if "default.exclusive_index_use" property is set to true or just not set (default is true), then the additionally this exception appears:

      2013-01-31 17:28:51,850 ERROR [LogErrorHandler] (Hibernate Search: Index updates queue processor for index person-1) HSEARCH000058: Exception occurred org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: org.infinispan.lucene.locking.BaseLuceneLock@467110d4
      Primary Failure:
      	Entity org.infinispan.query.test.Person  Id S:BigGoat  Work Type  org.hibernate.search.backend.UpdateLuceneWork
      
      org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: org.infinispan.lucene.locking.BaseLuceneLock@467110d4
      	at org.apache.lucene.store.Lock.obtain(Lock.java:84)
      	at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1098)
      	at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.createNewIndexWriter(IndexWriterHolder.java:148)
      	at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.getIndexWriter(IndexWriterHolder.java:115)
      	at org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl.getIndexWriter(AbstractWorkspaceImpl.java:117)
      	at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:99)
      	at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:722)
      2013-01-31 17:28:51,852 ERROR [LuceneBackendQueueTask] (Hibernate Search: Index updates queue processor for index person-1) HSEARCH000072: Couldn't open the IndexWriter because of previous error: operation skipped, index ouf of sync!
      2013-01-31 17:28:52,857 ERROR [LogErrorHandler] (Hibernate Search: Index updates queue processor for index person-1) HSEARCH000058: Exception occurred org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: org.infinispan.lucene.locking.BaseLuceneLock@467110d4
      Primary Failure:
      	Entity org.infinispan.query.test.Person  Id S:MiniGoat  Work Type  org.hibernate.search.backend.UpdateLuceneWork
      
      org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: org.infinispan.lucene.locking.BaseLuceneLock@467110d4
      	at org.apache.lucene.store.Lock.obtain(Lock.java:84)
      	at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1098)
      	at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.createNewIndexWriter(IndexWriterHolder.java:148)
      	at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.getIndexWriter(IndexWriterHolder.java:115)
      	at org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl.getIndexWriter(AbstractWorkspaceImpl.java:117)
      	at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:99)
      	at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:722)
      2013-01-31 17:28:52,858 ERROR [LuceneBackendQueueTask] (Hibernate Search: Index updates queue processor for index person-1) HSEARCH000072: Couldn't open the IndexWriter because of previous error: operation skipped, index ouf of sync!
      

      You can find the tests attached.

              sgrinove Sanne Grinovero (Inactive)
              amanukya@redhat.com Anna Manukyan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: