From b488975ddd0c4b3fa3c0ab61ef77cf0ccf4c8528 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 24 May 2011 05:19:20 +0000 Subject: [PATCH] HBASE-3195 Binary row keys in hbck and other miscellaneous binary key display issues git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1126872 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ conf/hbase-env.sh | 4 ++-- .../hbase/executor/RegionTransitionData.java | 4 ++-- .../hbase/master/AssignmentManager.java | 4 ++++ .../apache/hadoop/hbase/master/HMaster.java | 19 +++++++++++-------- .../apache/hadoop/hbase/util/HBaseFsck.java | 15 ++++++--------- .../apache/hadoop/hbase/zookeeper/ZKUtil.java | 2 +- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 923df0a264e..0a6b631aa45 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -283,6 +283,8 @@ Release 0.90.4 - Unreleased HBASE-3905 HBaseAdmin.createTableAsync() should check for invalid split keys (Ted Yu) HBASE-3908 TableSplit not implementing "hashCode" problem (Daniel Iancu) + HBASE-3915 Binary row keys in hbck and other miscellaneous binary key + display issues IMPROVEMENT HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the diff --git a/conf/hbase-env.sh b/conf/hbase-env.sh index e3948d8e0f7..2d55d27935f 100644 --- a/conf/hbase-env.sh +++ b/conf/hbase-env.sh @@ -36,8 +36,8 @@ # see http://wiki.apache.org/hadoop/PerformanceTuning export HBASE_OPTS="-ea -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode" -# Uncomment below to enable java garbage collection logging. -# export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:$HBASE_HOME/logs/gc-hbase.log" +# Uncomment below to enable java garbage collection logging in the .out file. +# export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps" # Uncomment and adjust to enable JMX exporting # See jmxremote.password and jmxremote.access in $JRE_HOME/lib/management to configure remote password access. diff --git a/src/main/java/org/apache/hadoop/hbase/executor/RegionTransitionData.java b/src/main/java/org/apache/hadoop/hbase/executor/RegionTransitionData.java index 0f49dc14487..1dc614471b9 100644 --- a/src/main/java/org/apache/hadoop/hbase/executor/RegionTransitionData.java +++ b/src/main/java/org/apache/hadoop/hbase/executor/RegionTransitionData.java @@ -243,7 +243,7 @@ public class RegionTransitionData implements Writable { @Override public String toString() { - return "region=" + Bytes.toString(regionName) + ", origin=" + this.origin + + return "region=" + Bytes.toStringBinary(regionName) + ", origin=" + this.origin + ", state=" + eventType; } -} \ No newline at end of file +} diff --git a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java index 7e473095b11..38914a834a9 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -1943,7 +1943,11 @@ public class AssignmentManager extends ZooKeeperListener { case OPEN: LOG.error("Region has been OPEN for too long, " + "we don't know where region was opened so can't do anything"); + synchronized(regionState) { + regionState.updateTimestampToNow(); + } break; + case PENDING_CLOSE: LOG.info("Region has been PENDING_CLOSE for too " + "long, running forced unassign again on region=" + diff --git a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 68b18c2fd20..f1d06d03bcb 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -51,7 +51,6 @@ import org.apache.hadoop.hbase.UnknownRegionException; import org.apache.hadoop.hbase.catalog.CatalogTracker; import org.apache.hadoop.hbase.catalog.MetaEditor; import org.apache.hadoop.hbase.catalog.MetaReader; -import org.apache.hadoop.hbase.client.HConnectionManager; import org.apache.hadoop.hbase.client.MetaScanner; import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor; import org.apache.hadoop.hbase.client.Result; @@ -915,13 +914,17 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server { region.getLog().closeAndDelete(); } - // 5. Trigger immediate assignment of the regions in round-robin fashion - List servers = serverManager.getOnlineServersList(); - try { - this.assignmentManager.assignUserRegions(Arrays.asList(newRegions), servers); - } catch (InterruptedException ie) { - LOG.error("Caught " + ie + " during round-robin assignment"); - throw new IOException(ie); + if (newRegions.length == 1) { + this.assignmentManager.assign(newRegions[0], true); + } else { + // 5. Trigger immediate assignment of the regions in round-robin fashion + List servers = serverManager.getOnlineServersList(); + try { + this.assignmentManager.assignUserRegions(Arrays.asList(newRegions), servers); + } catch (InterruptedException ie) { + LOG.error("Caught " + ie + " during round-robin assignment"); + throw new IOException(ie); + } } // 6. If sync, wait for assignment of regions diff --git a/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index 53f933f40e7..39591a0a053 100644 --- a/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -422,12 +422,8 @@ public class HBaseFsck { if (inMeta && inHdfs && isDeployed && deploymentMatchesMeta && shouldBeDeployed) { return; } else if (inMeta && !isDeployed && splitParent) { - // Offline regions shouldn't cause complaints - LOG.debug("Region " + descriptiveName + " offline, split, parent, ignoring."); return; } else if (inMeta && !shouldBeDeployed && !isDeployed) { - // offline regions shouldn't cause complaints - LOG.debug("Region " + descriptiveName + " offline, ignoring."); return; } else if (recentlyModified) { LOG.warn("Region " + descriptiveName + " was recently modified -- skipping"); @@ -444,7 +440,7 @@ public class HBaseFsck { } else if (!inMeta && inHdfs && !isDeployed) { errors.reportError(ERROR_CODE.NOT_IN_META_OR_DEPLOYED, "Region " + descriptiveName + " on HDFS, but not listed in META " + - "or deployed on any region server."); + "or deployed on any region server"); } else if (!inMeta && inHdfs && isDeployed) { errors.reportError(ERROR_CODE.NOT_IN_META, "Region " + descriptiveName + " not in META, but deployed on " + Joiner.on(", ").join(hbi.deployedOn)); @@ -584,6 +580,7 @@ public class HBaseFsck { public boolean checkRegionChain() { Collections.sort(regions); HbckInfo last = null; + int originalErrorsCount = errors.getErrorList().size(); for (HbckInfo r : regions) { if (last == null) { @@ -607,8 +604,8 @@ public class HBaseFsck { errors.reportError(ERROR_CODE.REGION_CYCLE, String.format("The endkey for this region comes before the " + "startkey, startkey=%s, endkey=%s", - Bytes.toString(r.metaEntry.getStartKey()), - Bytes.toString(r.metaEntry.getEndKey())), + Bytes.toStringBinary(r.metaEntry.getStartKey()), + Bytes.toStringBinary(r.metaEntry.getEndKey())), this, r, last); } } @@ -617,7 +614,7 @@ public class HBaseFsck { if (Bytes.equals(r.metaEntry.getStartKey(), last.metaEntry.getStartKey())) { errors.reportError(ERROR_CODE.DUPE_STARTKEYS, "Two regions have the same startkey: " - + Bytes.toString(r.metaEntry.getStartKey()), + + Bytes.toStringBinary(r.metaEntry.getStartKey()), this, r, last); } else { // Check that the startkey is the same as the previous end key @@ -641,7 +638,7 @@ public class HBaseFsck { last = r; } - return errors.getErrorList().size() == 0; + return errors.getErrorList().size() == originalErrorsCount; } } diff --git a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java index 6312a2a2f01..0905451d55b 100644 --- a/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java +++ b/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java @@ -1021,6 +1021,6 @@ public class ZKUtil { (data == null? "null": data.length == 0? "empty": ( znode.startsWith(zkw.assignmentZNode) ? RegionTransitionData.fromBytes(data).toString() - : StringUtils.abbreviate(Bytes.toString(data), 32))))); + : StringUtils.abbreviate(Bytes.toStringBinary(data), 32))))); } }