3 Replies Latest reply on Apr 28, 2017 4:08 AM by ulablue

    custom query cache values are not overridden as shown in logs.

    ulablue

      Hello,

       

      I have defined the custom region for query cache as shown below. I have overridden specific config for this region but yet in the logs, it shows all of those configs as "0". Does it mean the configuration that are provided in standalone.xml are not taken in to effect ? Am I missing something in my configuration?

       

      persistence.xml

       

        <property name="hibernate.cache.region_prefix" value=""/>

        <property name="hibernate.cache.infinispan.data-region.cfg" value= "data-local-query"/>

       

      standalone.xml

        <cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan" statistics-enabled="true">

                      <local-cache name="entity">

                          <transaction mode="NON_XA"/>

                          <eviction strategy="LRU" max-entries="10000"/>

                          <expiration max-idle="100000"/>

                      </local-cache>

                      <local-cache name="local-query">

                          <eviction strategy="LRU" max-entries="10000"/>

                          <expiration max-idle="100000"/>

                      </local-cache>

                      <local-cache name="data-local-query" statistics-enabled="true">

                          <eviction strategy="LRU"  max-entries="12000" />

                          <expiration max-idle="14400000" interval="120000" lifespan="86400000"/>

                      </local-cache>

                      <local-cache name="timestamps"/>

                  </cache-container>

       

      Why is it "0" even the default local query cache has values for max entries as 10000 ? Are these logs are wrong ?

      logs

      2017-04-21 10:39:29,244 INFO  [org.hibernate.cache.internal.StandardQueryCache] (default task-13) HHH000248: Starting query cache at region: data-region

      2017-04-21 10:39:29,244 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (default task-13) Building query results cache region [data-region]

      2017-04-21 10:39:29,245 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (default task-13) Cache region specific configuration exists: TypeOverrides{cache=data-local-query, strategy=null, wakeUpInterval=0, maxEntries=0, lifespan=0, maxIdle=0}

      2017-04-21 10:39:29,246 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (default task-13) Configuration override via property hibernate.cache.infinispan.statistics: null

      2017-04-21 10:39:29,265 INFO  [org.jboss.as.clustering.infinispan] (default task-13) WFLYCLINF0002: Started data-region cache from hibernate container

       

      If I start to run some tests, I can see below logs which seems to show that it is fetching results from query cache. But is it really working ? how can I prove that this works with my overridden configuration ? Thanks in advance.

       

      2017-04-21 11:05:31,684 DEBUG [org.hibernate.cache.internal.StandardQueryCache] (default task-6) Checking query spaces are up-to-date: [TABLE1]

      2017-04-21 11:05:31,684 DEBUG [org.hibernate.cache.internal.StandardQueryCache] (default task-6) Returning cached query results

        • 1. Re: custom query cache values are not overridden as shown in logs.
          rvansa

          In WildFly, the region prefix is appended with the deployment name - so you need to set property hibernate.cache.infinispan.my-deployment.war#data-region.cfg

          • 2. Re: custom query cache values are not overridden as shown in logs.
            ulablue

            Thanks for your answer.

            Isn't this supposed to make it no prefix "" ?

              <property name="hibernate.cache.region_prefix" value=""/>

             

            But anyhow, I had added the app.war prefix and it did not work. Also I think the problem is not that because the log shows that it can find the region has overridden configuration but only the values are not what is provided in config.

             

            2017-04-21 10:39:29,245 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (default task-13) Cache region specific configuration exists: TypeOverrides{cache=data-local-query, strategy=null, wakeUpInterval=0, maxEntries=0, lifespan=0, maxIdle=0}

             

            Does the above log actually mean that the cache is indeed "data-local-query" and its applicable configuration. But it does not print them in log ? How can I print the region specific configuration once it is being used ?

             

            Finally I tried to move all configuration from standalone.xml to persistence.xml and now it seems to be working! But I would like to provide the config in standalone.xml itself.

             

            2017-04-21 15:25:36,196 INFO  [org.hibernate.cache.internal.StandardQueryCache] (default task-3) HHH000248: Starting query cache at region: data-region

            2017-04-21 15:25:36,198 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (default task-3) Building query results cache region [data-region]

            2017-04-21 15:25:36,199 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (default task-3) Cache region specific configuration exists: TypeOverrides{cache=null, strategy=LRU, wakeUpInterval=0, maxEntries=12000, lifespan=86400000, maxIdle=14400000}

            2017-04-21 15:25:36,199 DEBUG [org.hibernate.cache.infinispan.InfinispanRegionFactory] (default task-3) Configuration override via property hibernate.cache.infinispan.statistics: null

            2017-04-21 15:25:36,219 INFO  [org.jboss.as.clustering.infinispan] (default task-3) WFLYCLINF0002: Started data-region cache from hibernate container

            • 3. Re: custom query cache values are not overridden as shown in logs.
              ulablue
              Does the above log actually mean that the cache is indeed "data-local-query" and its applicable configuration. But it does not print them in log ? How can I print the region specific configuration once it is being used ?

              answering to my own question. Yes the logs are printed with configuration from persistence.xml. But eventually the configuration are used as specified in it either via cache or by it properties.