[infinispan-issues] [JBoss JIRA] Commented: (ISPN-849) testTransactional doesn't ever work

luca stancapiano (JIRA) jira-events at lists.jboss.org
Sun Dec 26 13:51:17 EST 2010


    [ https://issues.jboss.org/browse/ISPN-849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572312#comment-12572312 ] 

luca stancapiano commented on ISPN-849:
---------------------------------------

About org.infinispan.distribution.BaseDistFunctionalTest class (row 201) :

   protected void assertOnAllCachesAndOwnership(Object key, String value) {
      for (Cache<Object, String> c : caches) {
         Object realVal = c.get(key);
         if (value == null) {
            assert realVal == null : "Expecting [" + key + "] to equal [" + value + "] on cache ["
                  + addressOf(c) + "] but was [" + realVal + "]";
         } else {
            assert value.equals(realVal) : "Expecting [" + key + "] to equal [" + value + "] on cache ["
                  + addressOf(c) + "] but was [" + realVal + "]";
         }
      }
      if (value != null) assertOwnershipAndNonOwnership(key);
   }

This method works with two caches. For example:

[Cache 'dist'@NodeH-53487, Cache 'dist'@NodeE-29465]

The first always returns the value "transactionally_replaced". The second sometimes returns "v1" instead of "transactionally_replaced". I suppose the caches always should be synchronized so could be a replication error through the caches 

> testTransactional doesn't ever work
> -----------------------------------
>
>                 Key: ISPN-849
>                 URL: https://issues.jboss.org/browse/ISPN-849
>             Project: Infinispan
>          Issue Type: Bug
>         Environment: mac osx
> java version "1.6.0_22"
> Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
> Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)
> Apache Maven 3.0 (r1004208; 2010-10-04 13:50:56+0200)
>            Reporter: luca stancapiano
>            Assignee: Manik Surtani
>
> I'm triing testTransactional inside distribution.rehash.ConcurrentNonOverlappingLeaveTest . Often it doesn't update the c1 cache with the value "transactionally_replaced" instead of "v1".
> I thought about a syncronization problem of the Threads but I see that the put of the field always is executed before the get. Actually the problem seems be in org.infinispan.distribution.rehash.RehashTestBase class (95-109):
>                TransactionManager t1 = TestingUtil.getTransactionManager(c1);
>                t1.begin();
>                c1.put(keys.get(0), "transactionally_replaced");
>                Transaction tx = t1.getTransaction();
>                tx.enlistResource(new XAResourceAdapter() {
>                   public int prepare(Xid id) {
>                      // this would be called *after* the cache prepares.
>                      try {
>                         l.await();
>                      } catch (InterruptedException e) {
>                      }
>                      return XAResource.XA_OK;
>                   }
>                });
>                t1.commit();
> maybe sometime there is a rollback

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the infinispan-issues mailing list