Infinispan 5.2 index not loading initial data
shadowcreeper Jun 4, 2013 5:44 PMI have an indexed Infinispan (5.2.1.Final) cache running from a WAR in JBoss (7.1.2.Final).
I have included the Infinispan (and hibernate search, and apache lucene) jars in my WAR.
When I start the app with *no* data in the cache store +everything+ works as expected (cache and index). I can create new cached objects which are indexed and I can query them.
When I start the app *with* data in the cache store, the cache itself works as expected, but the +index+ remains empty. I can retrieve objects from the cache that were initially in the store, but querying the cache produces an empty list, and only newly added cache entries ever get indexed and return from queries. The behavior is the same whether *preload* is +true+ or +false+.
Is there a config option I'm missing? Possibly a property of the indexing config?
My infinispan config file follows:
{code:xml}
<infinispan xmlns="urn:infinispan:config:5.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="urn:infinispan:config:jdbc:5.2"
xsi:schemaLocation="urn:infinispan:config:5.2
http://www.infinispan.org/schemas/infinispan-config-5.2.xsd
urn:infinispan:config:jdbc:5.2
http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-5.2.xsd">
<global>
<globalJmxStatistics
enabled="true"
cacheManagerName="CacheManager_TEST"
jmxDomain="test.cache.CacheManager_TEST" />
<transport
clusterName="CacheManager_TEST"
distributedSyncTimeout="10000" />
</global>
<default>
<jmxStatistics enabled="true" />
<!-- Use a replicated cluster -->
<clustering mode="repl">
<sync replTimeout="10000" />
<stateTransfer timeout="10000" />
</clustering>
<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.JBossTransactionManagerLookup"
transactionMode="TRANSACTIONAL"
autoCommit="false"
lockingMode="OPTIMISTIC"
useSynchronization="true"
reaperWakeUpInterval="1000" />
<locking isolationLevel="REPEATABLE_READ" />
<eviction maxEntries="4" strategy="LRU" />
<expiration
maxIdle="1800000"
lifespan="-1"
reaperEnabled="true"
wakeUpInterval="1000" />
<indexing enabled="true" indexLocalOnly="false">
<properties>
<property name="default.directory_provider" value="ram" />
</properties>
</indexing>
<loaders passivation="false" shared="true" preload="false">
<jdbc:stringKeyedJdbcStore
fetchPersistentState="false"
ignoreModifications="false"
purgeOnStartup="false">
<jdbc:dataSource jndiUrl="java:jboss/datasources/DefaultDS" />
<jdbc:stringKeyedTable
dropOnExit="false"
createOnStart="true"
prefix="ISPN_STRING_TABLE">
<jdbc:idColumn name="ID" type="VARCHAR(255)" />
<jdbc:dataColumn name="DATA" type="VARBINARY(8000)" />
<jdbc:timestampColumn name="TIMESTAMP" type="BIGINT" />
</jdbc:stringKeyedTable>
</jdbc:stringKeyedJdbcStore>
</loaders>
</default>
</infinispan>
{code}
Here is my query function:
{code}
@NotNull
public List<CachedEntity> getCachedEntities ( @NotNull String searchText )
{
SearchManager searchManager = Search.getSearchManager( m_cache );
QueryBuilder queryBuilder = searchManager.buildQueryBuilderForClass( CachedEntity.class ).get();
Query luceneQuery = queryBuilder.keyword().onField( "searchField" ).matching( searchText ).createQuery();
// cache uses non-local-only index, so local query
CacheQuery cacheQuery = searchManager.getQuery( luceneQuery, CachedEntity.class );
//noinspection unchecked
return (List)cacheQuery.list();
}
{code}
Thanks for any help or pointers you can provide.
-Ralph