hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1482698 - in /hbase/branches/0.95/hbase-server/src: main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java test/java/org/apache/hadoop/hbase/util/TestIdLock.java
Date Wed, 15 May 2013 06:58:41 GMT
Author: enis
Date: Wed May 15 06:58:40 2013
New Revision: 1482698

URL: http://svn.apache.org/r1482698
Log:
HBASE-8547 Fix java.lang.RuntimeException: Cached an already cached block

Modified:
    hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIdLock.java

Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java?rev=1482698&r1=1482697&r2=1482698&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
(original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java
Wed May 15 06:58:40 2013
@@ -292,7 +292,9 @@ public class LruBlockCache implements Bl
   public void cacheBlock(BlockCacheKey cacheKey, Cacheable buf, boolean inMemory) {
     CachedBlock cb = map.get(cacheKey);
     if(cb != null) {
-      throw new RuntimeException("Cached an already cached block");
+      String msg = "Cached an already cached block: " + cacheKey + " cb:" + cb.getCacheKey();
+      LOG.warn(msg);
+      assert false : msg;
     }
     cb = new CachedBlock(cacheKey, buf, count.incrementAndGet(), inMemory);
     long newSize = updateSizeMetrics(cb, false);

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java?rev=1482698&r1=1482697&r2=1482698&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java
Wed May 15 06:58:40 2013
@@ -123,8 +123,9 @@ public class TestLruBlockCache {
       try {
         cache.cacheBlock(block.cacheKey, block);
         assertTrue("Cache should not allow re-caching a block", false);
-      } catch(RuntimeException re) {
+      } catch(AssertionError re) {
         // expected
+        assertTrue(re.getMessage().contains("Cached an already cached block"));
       }
     }
 

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIdLock.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIdLock.java?rev=1482698&r1=1482697&r2=1482698&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIdLock.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestIdLock.java
Wed May 15 06:58:40 2013
@@ -19,6 +19,8 @@
 
 package org.apache.hadoop.hbase.util;
 
+import static org.junit.Assert.assertTrue;
+
 import java.util.Map;
 import java.util.Random;
 import java.util.concurrent.Callable;
@@ -27,12 +29,10 @@ import java.util.concurrent.ExecutorComp
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-
-import static org.junit.Assert.*;
-
 import org.apache.hadoop.hbase.MediumTests;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -105,6 +105,7 @@ public class TestIdLock {
       idLock.assertMapEmpty();
     } finally {
       exec.shutdown();
+      exec.awaitTermination(5000, TimeUnit.MILLISECONDS);
     }
   }
 



Mime
View raw message