Jelajahi Sumber

ZOOKEEPER-121. SyncRequestProcessor is not closing log stream during shutdown

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@924027 13f79535-47bb-0310-9956-ffa450edef68
Benjamin Reed 15 tahun lalu
induk
melakukan
5749256a08

+ 3 - 0
CHANGES.txt

@@ -285,6 +285,9 @@ BUGFIXES:
   ZOOKEEPER-121_3. SyncRequestProcessor is not closing log stream during
   shutdown (mahadev via phunt)
 
+  ZOOKEEPER-121_4. SyncRequestProcessor is not closing log stream during
+  shutdown (mahadev via breed)
+
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "socket reuse" and failure to close client (phunt via mahadev)

+ 5 - 5
src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java

@@ -672,11 +672,6 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
 
     public void shutdown() {
         running = false;
-        try {
-            zkDb.close();
-        } catch (IOException ie) {
-            LOG.warn("Error closing logs ", ie);
-        }
         if (leader != null) {
             leader.shutdown("quorum Peer shutdown");
         }
@@ -691,6 +686,11 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         if(getElectionAlg() != null){
         	getElectionAlg().shutdown();
         }
+        try {
+            zkDb.close();
+        } catch (IOException ie) {
+            LOG.warn("Error closing logs ", ie);
+        }     
     }
 
     /**

+ 2 - 0
src/java/test/org/apache/zookeeper/test/QuorumQuotaTest.java

@@ -40,11 +40,13 @@ public class QuorumQuotaTest extends QuorumBase {
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        LOG.info("STARTING " + getClass().getName());
     }
 
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
+        LOG.info("STOPPING " + getClass().getName());
     }
 
     public void testQuotaWithQuorum() throws Exception {

+ 1 - 1
src/java/test/org/apache/zookeeper/test/QuorumZxidSyncTest.java

@@ -41,7 +41,7 @@ public class QuorumZxidSyncTest extends TestCase {
     @Before
     @Override
     protected void setUp() throws Exception {
-        qb.setUp();
+    	qb.setUp();
     }
     
     @Test

+ 2 - 0
src/java/test/org/apache/zookeeper/test/ZkDatabaseCorruptionTest.java

@@ -44,10 +44,12 @@ public class ZkDatabaseCorruptionTest extends QuorumBase {
     @Before
     @Override
     protected void setUp() throws Exception {
+    	LOG.info("STARTING " + getClass().getName());
         qb.setUp();
     }
         
     protected void tearDown() throws Exception {
+    	LOG.info("STOPPING " + getClass().getName());
     }
     
     private void corruptFile(File f) throws IOException {

+ 2 - 0
src/java/test/org/apache/zookeeper/test/ZooKeeperQuotaTest.java

@@ -42,11 +42,13 @@ public class ZooKeeperQuotaTest extends ClientBase {
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        LOG.info("STARTING " + getClass().getName());
     }
 
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
+        LOG.info("STOPPING " + getClass().getName());
     }
 
     public void testQuota() throws IOException,