From 46ff7775f6f07511471ca9bb0cf9f506956f06b2 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Mon, 24 Mar 2008 22:42:14 +0000 Subject: [PATCH] HBASE-534 Double-assignment at SPLIT-time git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@640625 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/java/org/apache/hadoop/hbase/master/RegionManager.java | 7 ++++++- src/java/org/apache/hadoop/hbase/master/ServerManager.java | 4 ++-- src/java/org/apache/hadoop/hbase/regionserver/HStore.java | 7 ++++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index cfd14ca6256..596c652bf4f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -54,6 +54,7 @@ Hbase Change Log files (Clint Morgan via Jim Kellerman) HBASE-527 RegexpRowFilter does not work when there are columns from multiple families (Clint Morgan via Jim Kellerman) + HBASE-534 Double-assignment at SPLIT-time IMPROVEMENTS HBASE-415 Rewrite leases to use DelayedBlockingQueue instead of polling diff --git a/src/java/org/apache/hadoop/hbase/master/RegionManager.java b/src/java/org/apache/hadoop/hbase/master/RegionManager.java index dc623f91d8c..a7578b599f8 100644 --- a/src/java/org/apache/hadoop/hbase/master/RegionManager.java +++ b/src/java/org/apache/hadoop/hbase/master/RegionManager.java @@ -473,7 +473,12 @@ class RegionManager implements HConstants { /** Set a region to unassigned */ public void setUnassigned(HRegionInfo info) { - unassignedRegions.put(info, ZERO_L); + synchronized(this.unassignedRegions) { + if (!this.unassignedRegions.containsKey(info) && + !this.pendingRegions.contains(info.getRegionName())) { + this.unassignedRegions.put(info, ZERO_L); + } + } } /** Set a region to pending assignment */ diff --git a/src/java/org/apache/hadoop/hbase/master/ServerManager.java b/src/java/org/apache/hadoop/hbase/master/ServerManager.java index 1dfcb592303..74a26a97ced 100644 --- a/src/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/src/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -409,7 +409,7 @@ class ServerManager implements HConstants { HRegionInfo newRegionB = splitB.getRegionInfo(); master.regionManager.setUnassigned(newRegionB); - LOG.info("region " + region.getRegionName() + " split. New regions are: " + + LOG.info("Region " + region.getRegionName() + " split; new regions: " + newRegionA.getRegionName() + ", " + newRegionB.getRegionName()); if (region.isMetaTable()) { @@ -418,7 +418,7 @@ class ServerManager implements HConstants { master.regionManager.incrementNumMetaRegions(); } } - + /** Region server is reporting that a region is now opened */ private void processRegionOpen(String serverName, HServerInfo serverInfo, HRegionInfo region, ArrayList returnMsgs) diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java index f5c3631346d..d42d90bc3d4 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -783,9 +783,10 @@ public class HStore implements HConstants { // Add info about which file threw exception. It may not be in the // exception message so output a message here where we know the // culprit. - LOG.warn("Failed with " + e.toString() + ": " + hsf.toString() + - (hsf.isReference() ? " " + hsf.getReference().toString() : "") + - " for " + this.storeName); + LOG.warn("Failed with " + e.toString() + ": HStoreFile=" + + hsf.toString() + (hsf.isReference()? ", Reference=" + + hsf.getReference().toString() : "") + " for Store=" + + this.storeName); closeCompactionReaders(rdrs); throw e; }