geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject cvs commit: incubator-geronimo/modules/transaction/src/test/org/apache/geronimo/transaction/manager RecoveryTest.java
Date Tue, 27 Jul 2004 03:52:16 GMT
gdamour     2004/07/26 20:52:15

  Modified:    modules/transaction/src/java/org/apache/geronimo/transaction/manager
                        RecoveryImpl.java
               modules/transaction/src/test/org/apache/geronimo/transaction/manager
                        RecoveryTest.java
  Log:
  When a failure occurs between the 2PC of a XAResource and the force-write of the committed
event by
  TransactionLog, RecoveryImpl was not "correctly" doing a force-write of the committed event
after recovery
  due to a very minor bug.
  
  Revision  Changes    Path
  1.4       +2 -1      incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/manager/RecoveryImpl.java
  
  Index: RecoveryImpl.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/transaction/src/java/org/apache/geronimo/transaction/manager/RecoveryImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RecoveryImpl.java	22 Jul 2004 03:39:01 -0000	1.3
  +++ RecoveryImpl.java	27 Jul 2004 03:52:15 -0000	1.4
  @@ -77,6 +77,7 @@
                       Set transactionsForName = (Set)nameToOurTxMap.get(name);
                       if (transactionsForName == null) {
                           transactionsForName = new HashSet();
  +                        nameToOurTxMap.put(name, transactionsForName);
                       }
                       transactionsForName.add(xidBranchesPair);
                   }
  
  
  
  1.3       +23 -1     incubator-geronimo/modules/transaction/src/test/org/apache/geronimo/transaction/manager/RecoveryTest.java
  
  Index: RecoveryTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/transaction/src/test/org/apache/geronimo/transaction/manager/RecoveryTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RecoveryTest.java	11 Jun 2004 19:20:55 -0000	1.2
  +++ RecoveryTest.java	27 Jul 2004 03:52:15 -0000	1.3
  @@ -40,6 +40,28 @@
       private final String RM2 = "rm2";
       private final String RM3 = "rm3";
   
  +    public void testCommittedRMToBeRecovered() throws Exception {
  +        MockLog mockLog = new MockLog();
  +        Xid[] xids = getXidArray(1);
  +        // specifies an empty Xid array such that this XAResource has nothing
  +        // to recover. This means that the presumed abort protocol has failed
  +        // right after the commit of the RM and after the force-write of the
  +        // prepared log record.
  +        MockXAResource xares1 = new MockXAResource(RM1, new Xid[0]);
  +        MockTransactionInfo[] txInfos = makeTxInfos(xids);
  +        addBranch(txInfos, xares1);
  +        prepareLog(mockLog, txInfos);
  +        Recovery recovery = new RecoveryImpl(mockLog, xidFactory);
  +        recovery.recoverLog();
  +        assertTrue(!recovery.hasRecoveryErrors());
  +        assertTrue(recovery.getExternalXids().isEmpty());
  +        assertTrue(!recovery.localRecoveryComplete());
  +        recovery.recoverResourceManager(xares1);
  +        assertEquals(0, xares1.committed.size());
  +        assertTrue(recovery.localRecoveryComplete());
  +        
  +    }
  +    
       public void test2ResOnlineAfterRecoveryStart() throws Exception {
           MockLog mockLog = new MockLog();
           Xid[] xids = getXidArray(3);
  
  
  

Mime
View raw message