Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1617

PutForExternalRead doesn't work with transactional caches and autoCommit=false.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • 5.1.0.FINAL
    • 5.1.0.CR1
    • Transactions
    • None

    Description

      putForExternalRead(PFER) suspends the transaction before invoking the underlaying put, which throws a ISException as the call is not performed in a transactional context.

      Here is the unit test:

      /**
       * @author Mircea Markus <mircea.markus@jboss.com> (C) 2011 Red Hat Inc.
       * @since 5.1
       */
      @Test (groups = "functional", testName = "tx.NoAutoCommitAndPferTest")
      public class NoAutoCommitAndPferTest extends SingleCacheManagerTest {
      
         @Override
         protected EmbeddedCacheManager createCacheManager() throws Exception {
            Configuration dsc = getDefaultStandaloneConfig(true);
            dsc.fluent().transaction().autoCommit(false);
            return new DefaultCacheManager(dsc);
         }
      
         public void testPferNoAutoCommitExplicitTransaction() throws Exception {
            tm().begin();
            cache.putForExternalRead("k","v");
            tm().commit();
            assert cache.get("k").equals("v"); //here is the failure!
         }
      
         public void testPferNoAutoCommit() throws Exception {
            cache.putForExternalRead("k","v");
            assert cache.get("k").equals("v"); //here is the failure!
         }
      }
      

      Attachments

        Activity

          People

            mircea.markus Mircea Markus (Inactive)
            mircea.markus Mircea Markus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: