Clustered and JDBCCacheLoader access to DB
jorgemoralespou_2 Jun 20, 2008 9:03 AMHi,
I`m trying to configure my cache loader to achieve the following:
1- Firts node incluster starts. Unable to retrieve state from memory (another cluster` node) so get it from DB
2- Second clustered node starts. Gets state from memory (another cluster`node)
On cache put. The cache that receives the local put, transmits state to the rest of the cluster, and persist data to DB.
On cache get. Get value from memory, if miss, retrieve it from cluster, if miss, retrieve it from DB.
Is this possible?
I have try 2 approaches:
Approach 1
<attribute name="FetchInMemoryState">true</attribute> <attribute name="InitialStateRetrievalTimeout">15000</attribute> <attribute name="CacheLoaderConfiguration"> <config> <passivation>false</passivation> <preload>/</preload> <shared>true</shared> <cacheloader> <class>org.jboss.cache.loader.JDBCCacheLoader</class> <properties> cache.jdbc.datasource=java:jdbc/som cache.jdbc.table.name=core_data cache.jdbc.table.create=true cache.jdbc.table.drop=false cache.jdbc.table.primarykey=jbosscache_pk cache.jdbc.fqn.column=fqn cache.jdbc.fqn.type=varchar(255) cache.jdbc.node.column=node cache.jdbc.node.type=blob cache.jdbc.parent.column=parent </properties> <async>true</async> <fetchPersistentState>false</fetchPersistentState> <ignoreModifications>false</ignoreModifications> </cacheloader> </config>
Approach 2
<attribute name="FetchInMemoryState">true</attribute> <attribute name="InitialStateRetrievalTimeout">15000</attribute> <config> <passivation>false</passivation> <preload>/</preload> <shared>true</shared> <cacheloader> <class> org.jboss.cache.loader.ClusteredCacheLoader </class> <properties>timeout=1000</properties> <async>true</async> <fetchPersistentState>false</fetchPersistentState> <ignoreModifications>false</ignoreModifications> </cacheloader> <cacheloader> <class> org.jboss.cache.loader.JDBCCacheLoader </class> <properties> cache.jdbc.datasource=java:jdbc/somservices cache.jdbc.table.name=provisioning_data cache.jdbc.table.create=true cache.jdbc.table.drop=false cache.jdbc.table.primarykey=provisioning_data_pk cache.jdbc.fqn.column=fqn cache.jdbc.fqn.type=varchar(255) cache.jdbc.node.column=node cache.jdbc.node.type=blob cache.jdbc.parent.column=parent </properties> <async>true</async> <fetchPersistentState>true</fetchPersistentState> <ignoreModifications>false</ignoreModifications> </cacheloader> What I see, with both of this configs, is that when I start second node in the cluster, it retrieves state from the other node, but it seems to update the database. It performs a delete all, and insert every retrieved value. I see the deletes , inserts in logs. Anyone can help? Is it possible what I want?