0 Replies Latest reply on Jan 8, 2018 1:49 AM by nadeempasha

    Hibernate-search using Infinispan. Running in multiple machines

    nadeempasha

      Hello,

       

       

      When i try to execute the application/program in 2 machines at the same time, 2 scenarios occurred,

      scenario-1: one process waits till the other process to get complete, and then the other one starts and it will get completed, and when i run search on both machines, i am able to see both the insertions.

      scenario-2: In this scenario both the process finishes at the same time, and when i search on both machines, i am able to get only one of the data inserted(which is random of 2) and other data is lost without throwing any exception.

      Also when i insert and search in the same process, then i can see the inserted data but it is not persisted in the index database.

       

       

      My persistence.xml file is

      <?xml version="1.0" encoding="UTF-8" ?>

      <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

          <persistence-unit name="IC" transaction-type="RESOURCE_LOCAL">

              <class>com.csgsol.model.Course</class>

              <properties>

                  <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>

                  <property name="javax.persistence.jdbc.url" value="jdbc:mysql://192.168.1.52:3306/abc"/>

                  <property name="javax.persistence.jdbc.user" value="my-un"/>

                  <property name="javax.persistence.jdbc.password" value="my-pwd"/>

       

       

                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>

                  <property name="hibernate.hbm2ddl.auto" value="update"/>

              

                  <property name="hibernate.search.default.directory_provider" value="infinispan"/>

                  <property name="hibernate.search.default.indexmanager" value="near-real-time"/>

                  <property name="hibernate.search.default.exclusive_index_use" value="false"/>

                  <property name="hibernate.search.default.worker.execution" value = "async"/>

                  <property name="hibernate.search.lucene_version" value="LUCENE_4_10_4"/>

                  <property name="hibernate.search.default.worker.thread_pool.size" value="2"/>

                  <property name="hibernate.search.default.worker.buffer_queue.size" value="50"/>

                  <property name="hibernate.search.infinispan.configuration_resourcename" value="infinispan.xml"/>

                          </properties>

                      </persistence-unit>

      </persistence>

       

       

      my infinispan.xml

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <infinispan

              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

              xsi:schemaLocation="urn:infinispan:config:7.2 http://www.infinispan.org/schemas/infinispan-config-7.2.xsd

              urn:infinispan:config:store:jdbc:7.2 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-7.2.xsd"

              xmlns="urn:infinispan:config:7.2"

              xmlns:jdbc="urn:infinispan:config:store:jdbc:7.2">

       

       

          <!-- *************************** -->

          <!-- System-wide global settings -->

          <!-- *************************** -->

          <jgroups>

              <!-- Note that the JGroups transport uses sensible defaults if no configuration

                  property is defined. See the JGroupsTransport javadocs for more flags.

                  jgroups-udp.xml is the default stack bundled in the Infinispan core jar: integration

                  and tuning are tested by Infinispan. -->

              <stack-file name="default-jgroups-tcp" path="default-jgroupsTcp.xml"/>

          </jgroups>

       

       

          <cache-container name="HibernateSearch" default-cache="default" statistics="false" shutdown-hook="DONT_REGISTER">

       

       

              <transport stack="default-jgroups-tcp"/>

       

       

              <!-- Duplicate domains are allowed so that multiple deployments with default configuration

                  of Hibernate Search applications work - if possible it would be better to use JNDI to share

                  the CacheManager across applications -->

              <jmx duplicate-domains="true"/>

       

       

              <!-- *************************************** -->

              <!--  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"/>

                  <persistence passivation="false" >

                      <!--<cluster-loader remote-timeout="15000" preload="true"/>-->

                      <jdbc:string-keyed-jdbc-store preload="true" shared="true" fetch-state="true" read-only="false" purge="false">

                          <write-behind modification-queue-size="1024" thread-pool-size="23" flush-lock-timeout="1"

                                        shutdown-timeout="75000"/>

                          <property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>

                          <jdbc:connection-pool connection-url="jdbc:mysql://192.168.1.52:3306/hsearch"

                                                driver="com.mysql.jdbc.Driver" username="my-un"

                                                password="my-pwd"></jdbc:connection-pool>

                          <jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">

                              <jdbc:id-column name="ID" type="VARCHAR(255)"/>

                              <jdbc:data-column name="DATA" type="MEDIUMBLOB"/>

                              <jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>

                          </jdbc:string-keyed-table>

                      </jdbc:string-keyed-jdbc-store>

                  </persistence>

                  <indexing index="ALL"/>

              <state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>

              </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"/>

       

       

                  <persistence passivation="false">

                      <!--<cluster-loader remote-timeout="15000" preload="true"/>-->

                      <jdbc:string-keyed-jdbc-store preload="true" shared="true" fetch-state="true" read-only="false" purge="false">

                          <write-behind modification-queue-size="1024" thread-pool-size="23" flush-lock-timeout="1"

                                        shutdown-timeout="75000" />

                          <property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>

                          <jdbc:connection-pool connection-url="jdbc:mysql://192.168.1.52:3306/hsearch"

                                                driver="com.mysql.jdbc.Driver" username="my-un"

                                                password="my-pwd"></jdbc:connection-pool>

       

       

                          <jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">

                              <jdbc:id-column name="ID" type="VARCHAR(255)"/>

                              <jdbc:data-column name="DATA" type="MEDIUMBLOB"/>

                              <jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>

                          </jdbc:string-keyed-table>

                      </jdbc:string-keyed-jdbc-store>

                  </persistence>

                  <indexing index="ALL"/>

                  <state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>

              </replicated-cache>

       

       

              <!-- ***************************** -->

              <!--  Cache to store Lucene locks  -->

              <!-- ***************************** -->

              <replicated-cache name="LuceneIndexesLocking">

                  <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="ALL"/>

                  <state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>

              </replicated-cache>

          </cache-container>

       

       

      </infinispan>