"victor75" wrote : Thank you for the answer.
  | 
  | I have one problematic scenario.
  | There're two instances in my clustered environment: "serverA" and 
"serverB", at the beginning both of them are alive.
  | step 1. shutdown the "serverA" 
  | step 2. make a change in "serverB".
  | step 3. shutdown the "serverB" 
  | step 4. start the "serverA"
  | step 5. start the "serverB".
  | 
  | The problem is that a change in step 2 was lost.
  | 
  | Is there any solution here?
  | 
  | Victor. 

I've tried to do this as well with JBC 1.4.1, and I am using a cache loader as 
per Manik's suggestion, but I still get the same problem as Victor - changes to 
serverB are lost. 

So I thought I'd go back and look at the JUnit tests and run them. The one I am 
interested in is

  | build one.test.aop50 
-Dtest=org.jboss.cache.loader.CacheLoaderWithReplicationTest
  | 

I've added a test csae like this


  |     public void testPessSyncReplFailureRecovery1() throws Exception
  |     {
  |         cache1.setCacheMode(TreeCache.REPL_SYNC);
  |         cache2.setCacheMode(TreeCache.REPL_SYNC);
  | 
  |         cache1.startService();
  |         cache2.startService();
  | 
  |         Assert.assertNull(cache1.get(fqn, key));
  |         Assert.assertNull(cache2.get(fqn, key));
  | 
  | 
  |         CacheLoader loader1 = cache1.getCacheLoader();
  |         CacheLoader loader2 = cache2.getCacheLoader();
  | 
  |         TransactionManager mgr = cache1.getTransactionManager();
  |         mgr.begin();
  |         cache1.put(fqn, key, "value");
  | 
  |         Assert.assertEquals("value", cache1.get(fqn, key));
  |         Assert.assertNull(cache2.get(fqn, key));
  |         Assert.assertNull(loader1.get(fqn));
  |         Assert.assertNull(loader2.get(fqn));
  |         mgr.commit();
  | 
  |         Assert.assertEquals("value", cache1.get(fqn, key));
  |         Assert.assertEquals("value", cache2.get(fqn, key));
  |         Assert.assertEquals("value", loader1.get(fqn).get(key));
  |         Assert.assertEquals("value", loader2.get(fqn).get(key));
  | 
  |         cache2.stopService();
  | 
  |         mgr.begin();
  |         cache1.put(fqn, key, "value2");
  | 
  |         Assert.assertEquals("value2", cache1.get(fqn, key));
  |         Assert.assertEquals("value", loader1.get(fqn).get(key));
  | 
  |         mgr.commit();
  | 
  |         Assert.assertEquals("value2", cache1.get(fqn, key));
  |         Assert.assertEquals("value2", loader1.get(fqn).get(key));
  | 
  |         cache1.stopService();
  | 
  |         cache1.startService();
  |         cache2.startService();
  | 
  |         Assert.assertEquals("value2", cache1.get(fqn, key));
  |         Assert.assertEquals("value2", loader1.get(fqn).get(key));
  |         Assert.assertEquals("value2", cache2.get(fqn, key));
  |         Assert.assertEquals("value2", loader2.get(fqn).get(key));
  | 
  |         // force clean up
  |         tearDown();
  |     }
  | 

and it fails on the line in bold, indicating that the caches are in synch but 
that the cache loaders are not. Could somebody explain why please? Shouldn't 
the cache loaders also be in synch?

I then swapped the order in which cache1 and cache2 are restarted as follows

  |     public void testPessSyncReplFailureRecovery2() throws Exception
  |     {
  |         cache1.setCacheMode(TreeCache.REPL_SYNC);
  |         cache2.setCacheMode(TreeCache.REPL_SYNC);
  | 
  |         cache1.startService();
  |         cache2.startService();
  | 
  |         Assert.assertNull(cache1.get(fqn, key));
  |         Assert.assertNull(cache2.get(fqn, key));
  | 
  | 
  |         CacheLoader loader1 = cache1.getCacheLoader();
  |         CacheLoader loader2 = cache2.getCacheLoader();
  | 
  |         TransactionManager mgr = cache1.getTransactionManager();
  |         mgr.begin();
  |         cache1.put(fqn, key, "value");
  | 
  |         Assert.assertEquals("value", cache1.get(fqn, key));
  |         Assert.assertNull(cache2.get(fqn, key));
  |         Assert.assertNull(loader1.get(fqn));
  |         Assert.assertNull(loader2.get(fqn));
  |         mgr.commit();
  | 
  |         Assert.assertEquals("value", cache1.get(fqn, key));
  |         Assert.assertEquals("value", cache2.get(fqn, key));
  |         Assert.assertEquals("value", loader1.get(fqn).get(key));
  |         Assert.assertEquals("value", loader2.get(fqn).get(key));
  | 
  |         cache2.stopService();
  | 
  |         mgr.begin();
  |         cache1.put(fqn, key, "value2");
  | 
  |         Assert.assertEquals("value2", cache1.get(fqn, key));
  |         Assert.assertEquals("value", loader1.get(fqn).get(key));
  | 
  |         mgr.commit();
  | 
  |         Assert.assertEquals("value2", cache1.get(fqn, key));
  |         Assert.assertEquals("value2", loader1.get(fqn).get(key));
  | 
  |         cache1.stopService();
  | 
  |         cache2.startService();
  |         cache1.startService();
  | 
  |         Assert.assertEquals("value2", cache1.get(fqn, key));
  |         Assert.assertEquals("value2", loader1.get(fqn).get(key));
  |         Assert.assertEquals("value2", cache2.get(fqn, key));
  |         Assert.assertEquals("value2", loader2.get(fqn).get(key));
  | 
  |         // force clean up
  |         tearDown();
  |     }
  | 

and that fails on the line in bold, indicating that the update has been lost 
completely from cache1. Huh?

Anyone have ideas on how this is supposed to work? Have I misunderstood 
something? If not, it would be nice if these JUnit tests were included in the 
JBossCache test suite (and passed, obvs.)

Any input appreciated.

Chris

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4012051#4012051

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012051
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to