zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1446444 - in /zookeeper/bookkeeper/trunk: CHANGES.txt bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/HierarchicalLedgerManager.java bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
Date Fri, 15 Feb 2013 04:31:08 GMT
Author: sijie
Date: Fri Feb 15 04:31:08 2013
New Revision: 1446444

URL: http://svn.apache.org/r1446444
Log:
BOOKKEEPER-568: NPE during GC with HierarchicalLedgerManager (Matteo via sijie)

Added:
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/HierarchicalLedgerManager.java

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1446444&r1=1446443&r2=1446444&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Fri Feb 15 04:31:08 2013
@@ -14,6 +14,8 @@ Trunk (unreleased changes)
 
       BOOKKEEPER-554: fd leaking when move ledger index file (sijie, ivank via sijie)
 
+      BOOKKEEPER-568: NPE during GC with HierarchicalLedgerManager (Matteo via sijie)
+
     IMPROVEMENTS:
 
       BOOKKEEPER-555: Make BookieServer use Netty rather than a custom IO server (ivank)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/HierarchicalLedgerManager.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/HierarchicalLedgerManager.java?rev=1446444&r1=1446443&r2=1446444&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/HierarchicalLedgerManager.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/HierarchicalLedgerManager.java
Fri Feb 15 04:31:08 2013
@@ -416,7 +416,7 @@ class HierarchicalLedgerManager extends 
                 if (l1NodesIter == null) {
                     l1NodesIter = zk.getChildren(ledgerRootPath, null).iterator();
                     hasMoreElement = nextL1Node();
-                } else if (!l2NodesIter.hasNext()) {
+                } else if (l2NodesIter == null || !l2NodesIter.hasNext()) {
                     hasMoreElement = nextL1Node();
                 }
             } catch (Exception e) {

Added: zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java?rev=1446444&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
(added)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
Fri Feb 15 04:31:08 2013
@@ -0,0 +1,43 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.bookkeeper.meta;
+
+import org.apache.bookkeeper.meta.LedgerManager.LedgerRangeIterator;
+import org.junit.Test;
+
+public class LedgerManagerIteratorTest extends LedgerManagerTestCase {
+    public LedgerManagerIteratorTest(Class<? extends LedgerManagerFactory> lmFactoryCls)
{
+        super(lmFactoryCls);
+    }
+
+    @Test(timeout = 60000)
+    public void testIterateNoLedgers() throws Exception {
+        LedgerManager lm = getLedgerManager();
+        LedgerRangeIterator lri = lm.getLedgerRanges();
+        assertNotNull(lri);
+        if (lri.hasNext())
+            lri.next();
+
+        assertEquals(false, lri.hasNext());
+        assertEquals(false, lri.hasNext());
+    }
+}



Mime
View raw message