You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2014/08/07 00:57:16 UTC

git commit: HBASE-10205 ConcurrentModificationException in BucketAllocator (Arjen Roodselaar and Chunhui Shen)

Repository: hbase
Updated Branches:
  refs/heads/master cae7d7664 -> e17a3ca09


HBASE-10205 ConcurrentModificationException in BucketAllocator (Arjen Roodselaar and Chunhui Shen)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e17a3ca0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e17a3ca0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e17a3ca0

Branch: refs/heads/master
Commit: e17a3ca0913893d59562d8bfb40da4d70b3e39c7
Parents: cae7d76
Author: stack <st...@apache.org>
Authored: Wed Aug 6 15:56:31 2014 -0700
Committer: stack <st...@apache.org>
Committed: Wed Aug 6 15:56:31 2014 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/io/hfile/bucket/BucketAllocator.java | 14 +++++++-------
 .../hadoop/hbase/io/hfile/bucket/BucketCache.java     |  2 ++
 2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/e17a3ca0/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java
index 36fad56..9deca1a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java
@@ -20,7 +20,7 @@
 
 package org.apache.hadoop.hbase.io.hfile.bucket;
 
-import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
@@ -174,13 +174,13 @@ public final class BucketAllocator {
     private int sizeIndex;
 
     BucketSizeInfo(int sizeIndex) {
-      bucketList = new ArrayList<Bucket>();
-      freeBuckets = new ArrayList<Bucket>();
-      completelyFreeBuckets = new ArrayList<Bucket>();
+      bucketList = new LinkedList<Bucket>();
+      freeBuckets = new LinkedList<Bucket>();
+      completelyFreeBuckets = new LinkedList<Bucket>();
       this.sizeIndex = sizeIndex;
     }
 
-    public void instantiateBucket(Bucket b) {
+    public synchronized void instantiateBucket(Bucket b) {
       assert b.isUninstantiated() || b.isCompletelyFree();
       b.reconfigure(sizeIndex, bucketSizes, bucketCapacity);
       bucketList.add(b);
@@ -230,7 +230,7 @@ public final class BucketAllocator {
       return b;
     }
 
-    private void removeBucket(Bucket b) {
+    private synchronized void removeBucket(Bucket b) {
       assert b.isCompletelyFree();
       bucketList.remove(b);
       freeBuckets.remove(b);
@@ -246,7 +246,7 @@ public final class BucketAllocator {
       if (b.isCompletelyFree()) completelyFreeBuckets.add(b);
     }
 
-    public IndexStatistics statistics() {
+    public synchronized IndexStatistics statistics() {
       long free = 0, used = 0;
       for (Bucket b : bucketList) {
         free += b.freeCount();

http://git-wip-us.apache.org/repos/asf/hbase/blob/e17a3ca0/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
index 9a8cf5a..e756d59 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java
@@ -658,6 +658,8 @@ public class BucketCache implements BlockCache, HeapSize {
             + StringUtils.byteDesc(memory));
       }
 
+    } catch (Throwable t) {
+      LOG.warn("Failed freeing space", t);
     } finally {
       cacheStats.evict();
       freeInProgress = false;