zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1072074 - in /zookeeper/branches/branch-3.3: ./ src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/ src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/ src/contrib/bookkeeper/test/org/apache/bookkeeper/test/
Date Fri, 18 Feb 2011 17:25:40 GMT
Author: breed
Date: Fri Feb 18 17:25:39 2011
New Revision: 1072074

URL: http://svn.apache.org/viewvc?rev=1072074&view=rev
Log:
ZOOKEEPER-985. Test BookieRecoveryTest fails on trunk.

Modified:
    zookeeper/branches/branch-3.3/CHANGES.txt
    zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java
    zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieServer.java
    zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java
    zookeeper/branches/branch-3.3/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieRecoveryTest.java

Modified: zookeeper/branches/branch-3.3/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/CHANGES.txt?rev=1072074&r1=1072073&r2=1072074&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.3/CHANGES.txt Fri Feb 18 17:25:39 2011
@@ -18,6 +18,8 @@ BUGFIXES:
   ZOOKEEPER-913. Version parser fails to parse "3.3.2-dev" from build.xml
   (Anthony Urso and phunt via phunt)
 
+  ZOOKEEPER-985. Test BookieRecoveryTest fails on trunk. (fpj via breed)
+
 IMPROVEMENTS:
   ZOOKEEPER-963. Make Forrest work with JDK6 (Carl Steinbach via henryr)
 

Modified: zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java?rev=1072074&r1=1072073&r2=1072074&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java
(original)
+++ zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/bookie/Bookie.java
Fri Feb 18 17:25:39 2011
@@ -67,6 +67,9 @@ public class Bookie extends Thread {
 
     // ZooKeeper client instance for the Bookie
     ZooKeeper zk;
+    
+    // Running flag
+    private volatile boolean running = false;
 
     public static class NoLedgerException extends IOException {
         private static final long serialVersionUID = 1L;
@@ -377,6 +380,10 @@ public class Bookie extends Thread {
     
     private LastLogMark lastLogMark = new LastLogMark(0, 0);
     
+    public boolean isRunning(){
+        return running;
+    }
+    
     @Override
     public void run() {
         LinkedList<QueueEntry> toFlush = new LinkedList<QueueEntry>();
@@ -389,6 +396,7 @@ public class Bookie extends Thread {
             long nextPrealloc = preAllocSize;
             long lastFlushPosition = 0;
             logFile.write(zeros, nextPrealloc);
+            running = true;
             // TODO: Currently, when we roll over the journal logs, the older
             // ones are never garbage collected. We should remove a journal log
             // once all of its entries have been synced with the entry logs.
@@ -431,6 +439,7 @@ public class Bookie extends Thread {
         } catch (Exception e) {
             LOG.fatal("Bookie thread exiting", e);
         }
+        running = false;
     }
 
     private FileChannel openChannel(long logId) throws FileNotFoundException {

Modified: zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieServer.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieServer.java?rev=1072074&r1=1072073&r2=1072074&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieServer.java
(original)
+++ zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/BookieServer.java
Fri Feb 18 17:25:39 2011
@@ -38,7 +38,7 @@ import org.apache.log4j.Logger;
 public class BookieServer implements NIOServerFactory.PacketProcessor, BookkeeperInternalCallbacks.WriteCallback
{
     int port;
     NIOServerFactory nioServerFactory;
-    volatile boolean down = false;
+    private volatile boolean running = false;
     Bookie bookie;
     static Logger LOG = Logger.getLogger(BookieServer.class);
 
@@ -49,16 +49,17 @@ public class BookieServer implements NIO
 
     public void start() throws IOException {
         nioServerFactory = new NIOServerFactory(port, this);
+        running = true;
     }
 
     public void shutdown() throws InterruptedException {
-        down = true;
+        running = false;
         nioServerFactory.shutdown();
         bookie.shutdown();
     }
 
-    public boolean isDown() {
-        return down;
+    public boolean isRunning(){
+        return bookie.isRunning() && nioServerFactory.isRunning() && running;
     }
 
     public void join() throws InterruptedException {

Modified: zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java?rev=1072074&r1=1072073&r2=1072074&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java
(original)
+++ zookeeper/branches/branch-3.3/src/contrib/bookkeeper/src/java/org/apache/bookkeeper/proto/NIOServerFactory.java
Fri Feb 18 17:25:39 2011
@@ -90,6 +90,10 @@ public class NIOServerFactory extends Th
         }
     }
 
+    public boolean isRunning() {
+        return !ss.socket().isClosed();
+    }
+    
     @Override
     public void run() {
         while (!ss.socket().isClosed()) {

Modified: zookeeper/branches/branch-3.3/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieRecoveryTest.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.3/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieRecoveryTest.java?rev=1072074&r1=1072073&r2=1072074&view=diff
==============================================================================
--- zookeeper/branches/branch-3.3/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieRecoveryTest.java
(original)
+++ zookeeper/branches/branch-3.3/src/contrib/bookkeeper/test/org/apache/bookkeeper/test/BookieRecoveryTest.java
Fri Feb 18 17:25:39 2011
@@ -154,7 +154,8 @@ public class BookieRecoveryTest extends 
      *            Port to start the new bookie server on
      * @throws IOException
      */
-    private void startNewBookie(int port) throws IOException {
+    private void startNewBookie(int port)
+    throws IOException, InterruptedException {
         File f = File.createTempFile("bookie", "test");
         tmpDirs.add(f);
         f.delete();
@@ -162,6 +163,9 @@ public class BookieRecoveryTest extends 
         BookieServer server = new BookieServer(port, HOSTPORT, f, new File[] { f });
         server.start();
         bs.add(server);
+        while(!server.isRunning()){
+            Thread.sleep(500);
+        }
         LOG.info("New bookie on port " + port + " has been created.");
     }
 



Mime
View raw message