You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by iv...@apache.org on 2012/06/27 15:35:15 UTC

svn commit: r1354492 [2/3] - in /zookeeper/bookkeeper/trunk: ./ bookkeeper-server/ bookkeeper-server/src/main/java/org/apache/bookkeeper/client/ bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ bookkeeper-server/src/main/proto/ bookkeeper-s...

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/LICENSE.bin.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/LICENSE.bin.txt?rev=1354492&r1=1354491&r2=1354492&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/LICENSE.bin.txt (original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/LICENSE.bin.txt Wed Jun 27 13:35:11 2012
@@ -227,6 +227,43 @@ For lib/slf4j-*.jar
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 ------------------------------------------------------------------------------------
+For lib/protobuf-java-*.jar
+
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+    * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Code generated by the Protocol Buffer compiler is owned by the owner
+of the input file used when generating it.  This code is not
+standalone and requires a support library to be linked with it.  This
+support library is itself covered by the above license.
+
+------------------------------------------------------------------------------------
 For lib/jline-*.jar
 
 Copyright (c) 2002-2006, Marc Prud'hommeaux <mw...@cornell.edu>

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/NOTICE.bin.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/NOTICE.bin.txt?rev=1354492&r1=1354491&r2=1354492&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/NOTICE.bin.txt (original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/resources/NOTICE.bin.txt Wed Jun 27 13:35:11 2012
@@ -30,4 +30,4 @@ This project includes:
   SLF4J LOG4J-12 Binding under MIT License
   The Netty Project under Apache License, Version 2.0
   ZooKeeper under Apache License, Version 2.0
-
+  Protocol Buffer Java API under New BSD license

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java?rev=1354492&r1=1354491&r2=1354492&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java (original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieRecoveryTest.java Wed Jun 27 13:35:11 2012
@@ -469,7 +469,7 @@ public class BookieRecoveryTest extends 
         ranges.put(keyList.get(keyList.size()-1), untilEntry);
 
         for (Map.Entry<Long, ArrayList<InetSocketAddress>> e : ensembles.entrySet()) {
-            int quorum = md.quorumSize;
+            int quorum = md.getQuorumSize();
             long startEntryId = e.getKey();
             long endEntryId = ranges.get(startEntryId);
             long expectedSuccess = quorum*(endEntryId-startEntryId);

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/TestBackwardCompat.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/TestBackwardCompat.java?rev=1354492&r1=1354491&r2=1354492&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/TestBackwardCompat.java (original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/TestBackwardCompat.java Wed Jun 27 13:35:11 2012
@@ -26,6 +26,9 @@ import java.util.Enumeration;
 import java.util.Arrays;
 import java.net.InetAddress;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.junit.Test;
 import org.junit.Before;
 import org.junit.After;
@@ -34,6 +37,8 @@ import static org.junit.Assert.*;
 import org.apache.bookkeeper.bookie.FileSystemUpgrade;
 
 public class TestBackwardCompat {
+    static Logger LOG = LoggerFactory.getLogger(TestBackwardCompat.class);
+
     private static ZooKeeperUtil zkUtil = new ZooKeeperUtil();;
     private static int nextPort = 3181;
     private static byte[] ENTRY_DATA = "ThisIsAnEntry".getBytes();
@@ -140,11 +145,14 @@ public class TestBackwardCompat {
         }
 
         void close() throws Exception {
-            if (lh != null) {
-                lh.close();
-            }
-            if (bk != null) {
-                bk.close();
+            try {
+                if (lh != null) {
+                    lh.close();
+                }
+            } finally {
+                if (bk != null) {
+                    bk.close();
+                }
             }
         }
     }
@@ -234,11 +242,14 @@ public class TestBackwardCompat {
         }
 
         void close() throws Exception {
-            if (lh != null) {
-                lh.close();
-            }
-            if (bk != null) {
-                bk.close();
+            try {
+                if (lh != null) {
+                    lh.close();
+                }
+            } finally {
+                if (bk != null) {
+                    bk.close();
+                }
             }
         }
     }
@@ -328,11 +339,14 @@ public class TestBackwardCompat {
         }
 
         void close() throws Exception {
-            if (lh != null) {
-                lh.close();
-            }
-            if (bk != null) {
-                bk.close();
+            try {
+                if (lh != null) {
+                    lh.close();
+                }
+            } finally {
+                if (bk != null) {
+                    bk.close();
+                }
             }
         }
     }
@@ -417,16 +431,8 @@ public class TestBackwardCompat {
             // correct behaviour
         }
         lcur.write100();
-        try {
-            // Unfortunately, as the 4.0.0 client doesn't know that it should
-            // be checking for a password. It puts the ledger metadata in recover
-            // mode. This means we're not able to close, as our metadata znode is
-            // out of date
-            lcur.close();
+        lcur.close();
 
-            fail("Shouldn't be able to close cleanly");
-        } catch (Exception e) {
-        }
         lcur = LedgerCurrent.openLedger(fenceLedgerId);
         assertEquals(200, lcur.readAll());
         lcur.close();
@@ -436,7 +442,9 @@ public class TestBackwardCompat {
 
     /**
      * Test compatability between version 4.1.0 and the current version.
-     * Should be 100% compatible.
+     *  - A 4.1.0 client is not able to open a ledger created by the current
+     *    version due to a change in the ledger metadata format.
+     *  - Otherwise, they should be compatible.
      */
     @Test
     public void testCompat410() throws Exception {
@@ -478,6 +486,51 @@ public class TestBackwardCompat {
         l410.write100();
         l410.close();
 
+        // check that an old client can fence an old client
+        l410 = Ledger410.newLedger();
+        l410.write100();
+
+        Ledger410 l410f = Ledger410.openLedger(l410.getId());
+        try {
+            l410.write100();
+            fail("Shouldn't be able to write");
+        } catch (Exception e) {
+            // correct behaviour
+        }
+        l410f.close();
+        try {
+            l410.close();
+            fail("Shouldn't be able to close");
+        } catch (Exception e) {
+            // correct
+        }
+
+        // check that a new client can fence an old client
+        // and the old client can continue to read that ledger
+        l410 = Ledger410.newLedger();
+        l410.write100();
+
+        oldLedgerId = l410.getId();
+        lcur = LedgerCurrent.openLedger(oldLedgerId);
+        try {
+            l410.write100();
+            fail("Shouldn't be able to write");
+        } catch (Exception e) {
+            // correct behaviour
+        }
+        try {
+            l410.close();
+            fail("Shouldn't be able to close");
+        } catch (Exception e) {
+            // correct
+        }
+        lcur.close();
+
+        l410 = Ledger410.openLedger(oldLedgerId);
+
+        assertEquals(100, l410.readAll());
+        l410.close();
+
         // check that current client can read old ledger
         lcur = LedgerCurrent.openLedger(oldLedgerId);
         assertEquals(100, lcur.readAll());
@@ -488,18 +541,19 @@ public class TestBackwardCompat {
         assertEquals(100, lcur.readAll());
         lcur.close();
 
-        // check that old client can fence a current client
-        // due to lack of password
+        // check that old client can not fence a current client
+        // since it cannot open a new ledger due to the format changes
         lcur = LedgerCurrent.newLedger();
         lcur.write100();
         long fenceLedgerId = lcur.getId();
-        l410 = Ledger410.openLedger(fenceLedgerId);
         try {
-            lcur.write100();
-            fail("Fencing should have prevented this write");
+            l410 = Ledger410.openLedger(fenceLedgerId);
+            fail("Shouldn't be able to open ledger");
         } catch (Exception e) {
+            // correct behaviour
         }
-        assertEquals(100, l410.readAll());
+        lcur.write100();
+        lcur.close();
 
         scur.stop();
     }

Modified: zookeeper/bookkeeper/trunk/hedwig-protocol/pom.xml
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-protocol/pom.xml?rev=1354492&r1=1354491&r2=1354492&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-protocol/pom.xml (original)
+++ zookeeper/bookkeeper/trunk/hedwig-protocol/pom.xml Wed Jun 27 13:35:11 2012
@@ -32,7 +32,7 @@
     <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
-      <version>2.3.0</version>
+      <version>2.4.1</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
@@ -65,25 +65,37 @@
 	  </excludes>
 	</configuration>
       </plugin>
-      <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>default-cli</id>
-            <configuration>
-              <tasks>
-                <exec executable="protoc" failonerror="true">
-                  <arg value="--java_out=src/main/java" />
-                  <arg value="src/main/protobuf/PubSubProtocol.proto" />
-                </exec>
-              </tasks>
-            </configuration>
-            <goals>
-              <goal>run</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
+  <profiles>
+    <profile>
+      <id>protobuf</id>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>generate-sources</phase>
+                <id>default-cli</id>
+                <configuration>
+                  <target>
+		    <echo message="foo" />
+                    <exec executable="protoc" failonerror="true">
+                      <arg value="--java_out=src/main/java" />
+                      <arg value="src/main/protobuf/PubSubProtocol.proto" />
+                    </exec>
+		    <echo message="bar" />
+                  </target>
+                </configuration>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 </project>