Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1253

ChainedTransactionManager and Ignite SpringTransactionManager

    Details

    • Type: Bug
    • Status: Waiting for Feedback
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      I am using Apache Ignite's SpringTransactionManager in combination with HibernateTransactionManager in a ChainedTransactionManager in order to rollback all database and cache updates in the event of there being any failures in either transaction manager. I am finding that rollbacks in HibernateTransactionManager do cause rollbacks in SpringTransactionManager but not vice versa. Hibernate changes are not rolled back when Ignite transactions rollback.

      Logs from running the test:

      2018-02-02 15:09:00,509 DEBUG [unknown 192.168.1.10] main unknown unknown {AbstractPlatformTransactionManager.java:367} - Creating new transaction with name [com.dna.chain.service.impl.TestServiceImpl.testeroo]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; 'chainedTransactionManager'
      2018-02-02 15:09:00,514 DEBUG [unknown 192.168.1.10] main unknown unknown {AbstractPlatformTransactionManager.java:851} - Initiating transaction rollback
      2018-02-02 15:09:00,514 DEBUG [unknown 192.168.1.10] main unknown unknown {AbstractPlatformTransactionManager.java:1020} - Resuming suspended transaction after completion of inner transaction
      

      Here is how the transaction managers are configured and the test method:

      @Transactional("chainedTransactionManager")
      public void testeroo(Consumer<Params> consumer, Params params) {
          consumer.accept(params);
      }
      
      // Inserts params into databases first and then puts params into caches
      public final class Scenario2 implements Consumer<Params> {
      
          @Override
          public void accept(Params params) {
                  
              _scheduleDao.saveOrUpdate(schedule);
              _jobConfigDaoDao.saveOrUpdate(jobConfig);
      	_cache_1.put(pair.getFirst(), pair.getSecond());
      
      	throw new RuntimeException("inbound is null")
          }
      }
      
      @Bean
      public ChainedTransactionManager chainedTransactionManager(@Qualifier("hibernateTxMgr") PlatformTransactionManager hibernateTxMgr,
          @Qualifier("igniteTxMgr") PlatformTransactionManager igniteTxMgr) {
          ChainedTransactionManager transactionManager = new ChainedTransactionManager(
              new PlatformTransactionManager[] { hibernateTxMgr, igniteTxMgr });
          return transactionManager;
      }
      
      @Bean
      public PlatformTransactionManager hibernateTxMgr(@Qualifier("sessionFactory")SessionFactory sessionFactory) {
          HibernateTransactionManager manager = new HibernateTransactionManager(sessionFactory);
          return manager;
      }
      
      @Bean
      public PlatformTransactionManager igniteTxMgr(IgniteSpringBean ignite) throws IOException {
          SpringTransactionManager igniteTxMgr = new SpringTransactionManager();
          igniteTxMgr.setGridName(ignite.getConfiguration().getGridName());
          return igniteTxMgr;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              supercube Stephen Murphy
              Last updater:
              Stephen Murphy
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: