6 Replies Latest reply on Mar 23, 2016 9:49 AM by Gustavo Fernandes

    WARN: Forcing clear of index lock

    Nikita Dobryukha Newbie

      Hey guys!

      I have the following simple test class - TestRealHotRodServer.java

      with 2 pojo classes: Book.java and User.java

      marshallers: BookMarshaller.java and UserMarshaller.java

      and proto-files: book.proto and user.proto

      Finally I have two distributed caches in config infinispan.xml


      When I launch TestRealHotRodServer for the first time, I get one failed with empty search result list test (testBooksCache or testUsersCache).

      When I launch test-class a second time, I get all passed tests. But in the infinisan server log appears warning

      WARN  [org.infinispan.query.indexmanager.IndexManagerBasedLockController] (HotRodServerWorker-3-2) Forcing clear of index lock

      Finally, during a third and other times launching, I'm again getting one failed with empty search results list test. But in this case it is other test than first time.

       

      What did I make wrong?

        • 1. Re: WARN: Forcing clear of index lock
          Nikita Dobryukha Newbie

          15 views and there is no one idea?

          • 2. Re: WARN: Forcing clear of index lock
            Galder Zamarreño Master

            What Infinispan version are you using? Did you get any TRACE logs?

            • 4. Re: WARN: Forcing clear of index lock
              Gustavo Fernandes Apprentice

              The org.infinispan.query.indexmanager.InfinispanIndexManager stores indexes on Infinispan caches, by default they are called "LuceneIndexesData", "LuceneIndexesMetadata" and "LuceneIndexesLocking". Since you have two indexed caches, and are not specifying the index storage caches, both will try to use the same LuceneIndexesLocking cache and will compete for the lock. So you need to define different trios [default.data_cachename, locking_cachename, metadata_cachename] for each of your indexed caches.

              • 5. Re: WARN: Forcing clear of index lock
                Nikita Dobryukha Newbie

                Galder Zamarreño,

                Thanks a lot!

                When I defined different trios [default.data_cachename, locking_cachename, metadata_cachename] for each indexed caches everything worked.

                Could you say, why when we used Infinispan in an embedded mode with the following config everything also worked well?

                <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:8.1 http://www.infinispan.org/schemas/infinispan-config-8.1.xsd" xmlns="urn:infinispan:config:8.1">
                
                
                    <cache-container name="InMemoryCacheContainer" statistics="true" default-cache="the-default-cache" shutdown-hook="DEFAULT">
                
                
                        <transport cluster="InMemoryCacheCluster" />
                
                
                        <!-- *************************************** -->
                        <!-- Cache to store Lucene's file metadata   -->
                        <!-- *************************************** -->
                        <replicated-cache name="LuceneIndexesMetadata" mode="SYNC" remote-timeout="25000">
                            <locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false" />
                            <transaction mode="NONE" />
                            <eviction max-entries="-1" strategy="NONE" />
                            <expiration max-idle="-1" />
                            <indexing index="NONE" />
                            <state-transfer enabled="true" timeout="480000" />
                        </replicated-cache>
                
                
                        <!-- **************************** -->
                        <!-- Cache to store Lucene data   -->
                        <!-- **************************** -->
                        <replicated-cache name="LuceneIndexesData" mode="SYNC" remote-timeout="25000">
                            <locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false" />
                            <transaction mode="NONE" />
                            <eviction max-entries="-1" strategy="NONE" />
                            <expiration max-idle="-1" />
                            <indexing index="NONE" />
                            <state-transfer enabled="true" timeout="480000" />
                        </replicated-cache>
                
                
                        <!-- ***************************** -->
                        <!-- Cache to store Lucene locks   -->
                        <!-- ***************************** -->
                        <replicated-cache name="LuceneIndexesLocking" mode="SYNC" remote-timeout="25000">
                            <locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false" />
                            <transaction mode="NONE" />
                            <eviction max-entries="-1" strategy="NONE" />
                            <expiration max-idle="-1" />
                            <indexing index="NONE" />
                            <state-transfer enabled="true" timeout="480000" />
                        </replicated-cache>
                
                
                        <replicated-cache name="cache-one" statistics="true" mode="SYNC" remote-timeout="20000">
                            <transaction mode="BATCH" />
                            <eviction max-entries="-1" />
                            <expiration lifespan="-1" />
                            <indexing index="LOCAL" auto-config="false">
                                <property name="hibernate.search.default.directory_provider">infinispan</property>
                                <property name="hibernate.search.default.locking_cachename">LuceneIndexesLocking</property>
                                <property name="hibernate.search.default.data_cachename">LuceneIndexesData</property>
                                <property name="hibernate.search.default.metadata_cachename">LuceneIndexesMetadata</property>
                            </indexing>
                            <state-transfer enabled="true" />
                        </replicated-cache>
                
                
                        <replicated-cache name="cache-two" statistics="true" mode="SYNC" remote-timeout="20000">
                            <transaction mode="BATCH" />
                            <eviction max-entries="-1" />
                            <expiration lifespan="-1" />
                            <indexing index="LOCAL">
                                <property name="hibernate.search.default.directory_provider">infinispan</property>
                                <property name="hibernate.search.default.locking_cachename">LuceneIndexesLocking</property>
                                <property name="hibernate.search.default.data_cachename">LuceneIndexesData</property>
                                <property name="hibernate.search.default.metadata_cachename">LuceneIndexesMetadata</property>
                            </indexing>
                            <state-transfer enabled="true" />
                        </replicated-cache>
                
                
                    </cache-container>
                </infinispan>
                
                • 6. Re: WARN: Forcing clear of index lock
                  Gustavo Fernandes Apprentice

                  When in embedded mode, inside the index a "prefix" is stored which by default is named after the class name of your annotated @Indexed entity, so there's a separation of concerns. Even if more than one cache uses "LuceneIndexesLocking", the lock itself will be prefixed.

                  In remote mode, we cannot rely on annotations since remote queries should work with C++/C# clients besides Java.

                  I've opened a JIRA to track that requirement, but in the meantime, you should keep with the different trio of caches.