hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f..@apache.org
Subject svn commit: r774679 - in /hadoop/zookeeper/trunk: ./ src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ src/contrib/bookkeeper/test/org/apache/bookkeeper/test/
Date Thu, 14 May 2009 08:21:17 GMT
Author: fpj
Date: Thu May 14 08:21:16 2009
New Revision: 774679

URL: http://svn.apache.org/viewvc?rev=774679&view=rev
Log:
ZOOKEEPER-400. Issues with procedure to close ledger. (flavio)


Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ClientCBWorker.java
    hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerHandle.java
    hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java
    hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieReadWriteTest.java
    hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=774679&r1=774678&r2=774679&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu May 14 08:21:16 2009
@@ -72,6 +72,8 @@
 
   ZOOKEEPER-392. Change log4j properties in bookkeeper. (flavio via mahadev)
 
+  ZOOKEEPER-400. Issues with procedure to close ledger. (flavio)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

Modified: hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ClientCBWorker.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ClientCBWorker.java?rev=774679&r1=774678&r2=774679&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ClientCBWorker.java
(original)
+++ hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/ClientCBWorker.java
Thu May 14 08:21:16 2009
@@ -113,10 +113,11 @@
                     case Operation.ADD:
                         AddOp aOp = (AddOp) op;
                     
+                        aOp.getLedger().setAddConfirmed(aOp.entry);
                         aOp.cb.addComplete(aOp.getErrorCode(),
                             aOp.getLedger().getId(), aOp.entry, 
                             aOp.ctx);
-                        aOp.getLedger().setAddConfirmed(aOp.entry);
+                        
                         break;
                     case Operation.READ:
                         ReadOp rOp = (ReadOp) op;

Modified: hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerHandle.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerHandle.java?rev=774679&r1=774678&r2=774679&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerHandle.java
(original)
+++ hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerHandle.java
Thu May 14 08:21:16 2009
@@ -444,8 +444,8 @@
     throws KeeperException, InterruptedException {
         //Set data on zookeeper
         ByteBuffer last = ByteBuffer.allocate(8);
-        last.putLong(getLast());
-        LOG.info("Last saved on ZK is: " + getLast());
+        last.putLong(lastAddConfirmed);
+        LOG.info("Last saved on ZK is: " + lastAddConfirmed);
         String closePath = BookKeeper.prefix + bk.getZKStringId(getId()) + BookKeeper.close;

         if(bk.getZooKeeper().exists(closePath, false) == null){
            bk.getZooKeeper().create(closePath, 

Modified: hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java?rev=774679&r1=774678&r2=774679&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java
(original)
+++ hadoop/zookeeper/trunk/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/client/LedgerRecoveryMonitor.java
Thu May 14 08:21:16 2009
@@ -150,14 +150,12 @@
                     hasMore = false;
                     LOG.debug("Recovering: " + lh.getLast());
                     LedgerSequence ls = lh.readEntries(lh.getLast(), lh.getLast());
-                    //if(ls == null) throw BKException.create(Code.ReadException);
                     LOG.debug("Received entry for: " + lh.getLast());
                     
                     byte[] le = ls.nextElement().getEntry();
                     if(le != null){
                         if(notLegitimate) notLegitimate = false;
                         lh.addEntry(le);
-                        //lh.incLast();
                         hasMore = true;
                     }
                 }
@@ -168,7 +166,7 @@
          * Write counter as the last entry of ledger
          */
         if(!notLegitimate){
-            //lh.setLast(readCounter);
+            lh.setAddConfirmed(readCounter);
             lh.close();
             
             return true;

Modified: hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieReadWriteTest.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieReadWriteTest.java?rev=774679&r1=774678&r2=774679&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieReadWriteTest.java
(original)
+++ hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieReadWriteTest.java
Thu May 14 08:21:16 2009
@@ -189,7 +189,7 @@
 			
 			// wait for all entries to be acknowledged
 			synchronized (sync) {
-				if (sync.counter < numEntriesToWrite){
+				while (sync.counter < numEntriesToWrite){
 					LOG.debug("Entries counter = " + sync.counter);
 					sync.wait();
 				}
@@ -204,7 +204,7 @@
 			// open ledger
 			lh = bkc.openLedger(ledgerId, ledgerPassword);
 			LOG.debug("Number of entries written: " + lh.getLast());
-			assertTrue("Verifying number of entries written", lh.getLast() == numEntriesToWrite);
	
+			assertTrue("Verifying number of entries written", lh.getLast() == (numEntriesToWrite -
1));		
 			
 			//read entries
 			lh.asyncReadEntries(0, numEntriesToWrite - 1, this, (Object) sync);
@@ -269,7 +269,7 @@
 			
 			// wait for all entries to be acknowledged
 			synchronized (sync) {
-				if (sync.counter < numEntriesToWrite){
+				while (sync.counter < numEntriesToWrite){
 					LOG.debug("Entries counter = " + sync.counter);
 					sync.wait();
 				}
@@ -284,7 +284,7 @@
 			// open ledger
 			lh = bkc.openLedger(ledgerId, ledgerPassword);
 			LOG.debug("Number of entries written: " + lh.getLast());
-			assertTrue("Verifying number of entries written", lh.getLast() == numEntriesToWrite);
	
+			assertTrue("Verifying number of entries written", lh.getLast() == (numEntriesToWrite -
1));		
 			
 			//read entries			
 			ls = lh.readEntries(0, numEntriesToWrite - 1);
@@ -342,7 +342,7 @@
 			lh.close();
 			lh = bkc.openLedger(ledgerId, ledgerPassword);
 			LOG.debug("Number of entries written: " + lh.getLast());
-			assertTrue("Verifying number of entries written", lh.getLast() == numEntriesToWrite);
	
+			assertTrue("Verifying number of entries written", lh.getLast() == (numEntriesToWrite -
1));		
 			
 			ls = lh.readEntries(0, numEntriesToWrite - 1);
 			int i = 0;
@@ -394,7 +394,7 @@
 			lh.close();
 			lh = bkc.openLedger(ledgerId, ledgerPassword);
 			LOG.debug("Number of entries written: " + lh.getLast());
-			assertTrue("Verifying number of entries written", lh.getLast() == (numEntriesToWrite +
1));		
+			assertTrue("Verifying number of entries written", lh.getLast() == numEntriesToWrite);
	
 			
 			ls = lh.readEntries(0, numEntriesToWrite - 1);
 			int i = 0;
@@ -441,8 +441,8 @@
             lh2 = bkc.openLedger(ledgerId2, ledgerPassword);
             
             LOG.debug("Number of entries written: " + lh.getLast() + ", " + lh2.getLast());
-            assertTrue("Verifying number of entries written lh (" + lh.getLast() + ")" ,
lh.getLast() == numEntriesToWrite);
-            assertTrue("Verifying number of entries written lh2 (" + lh2.getLast() + ")",
lh2.getLast() == numEntriesToWrite);
+            assertTrue("Verifying number of entries written lh (" + lh.getLast() + ")" ,
lh.getLast() == (numEntriesToWrite - 1));
+            assertTrue("Verifying number of entries written lh2 (" + lh2.getLast() + ")",
lh2.getLast() == (numEntriesToWrite - 1));
             
             ls = lh.readEntries(0, numEntriesToWrite - 1);
             int i = 0;

Modified: hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java?rev=774679&r1=774678&r2=774679&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java
(original)
+++ hadoop/zookeeper/trunk/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/LedgerRecoveryTest.java
Thu May 14 08:21:16 2009
@@ -243,7 +243,7 @@
             /*
              * Check if has recovered properly.
              */
-            assertTrue("Has not recovered correctly: " + afterlh.getLast(), afterlh.getLast()
== 1000);
+            assertTrue("Has not recovered correctly: " + afterlh.getLast(), afterlh.getLast()
== 999);
         } catch (KeeperException e) {
             LOG.error("Error when opening ledger", e);
             fail("Couldn't open ledger");
@@ -328,7 +328,7 @@
             /*
              * Check if has recovered properly.
              */
-            assertTrue("Has not recovered correctly: " + afterlh.getLast(), afterlh.getLast()
== 1);
+            assertTrue("Has not recovered correctly: " + afterlh.getLast(), afterlh.getLast()
== 0);
         } catch (KeeperException e) {
             LOG.error("Error when opening ledger", e);
             fail("Couldn't open ledger");



Mime
View raw message