hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1584172 [2/2] - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase: ./ client/ io/ master/ regionserver/ regionserver/wal/ thrift/ util/
Date Wed, 02 Apr 2014 20:49:38 GMT
Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/MetaUtils.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/MetaUtils.java?rev=1584172&r1=1584171&r2=1584172&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/MetaUtils.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/MetaUtils.java Wed Apr
 2 20:49:37 2014
@@ -20,6 +20,13 @@
 
 package org.apache.hadoop.hbase.util;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
@@ -28,6 +35,8 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HTable;
@@ -38,15 +47,6 @@ import org.apache.hadoop.hbase.regionser
 import org.apache.hadoop.hbase.regionserver.InternalScanner;
 import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.regionserver.wal.HLog;
-import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.KeyValue;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
 
 /**
  * Contains utility methods for manipulating HBase meta tables.
@@ -224,9 +224,9 @@ public class MetaUtils {
         for (KeyValue kv: results) {
           info = Writables.getHRegionInfoOrNull(kv.getValue());
           if (info == null) {
-            LOG.warn("Region info is null for row " +
-              Bytes.toString(kv.getRow()) + " in table " +
-              r.getTableDesc().getNameAsString());
+            LOG.warn("Region info is null for row "
+                + Bytes.toStringBinary(kv.getRow()) + " in table "
+                + r.getTableDesc().getNameAsString());
           }
           continue;
         }
@@ -301,11 +301,13 @@ public class MetaUtils {
     Result res = t.get(get);
     KeyValue [] kvs = res.raw();
     if(kvs.length <= 0) {
-      throw new IOException("no information for row " + Bytes.toString(row));
+      throw new IOException("no information for row "
+          + Bytes.toStringBinary(row));
     }
     byte [] value = kvs[0].getValue();
     if (value == null) {
-      throw new IOException("no information for row " + Bytes.toString(row));
+      throw new IOException("no information for row "
+          + Bytes.toStringBinary(row));
     }
     HRegionInfo info = Writables.getHRegionInfo(value);
     Put put = new Put(row);
@@ -338,10 +340,11 @@ public class MetaUtils {
       scanMetaRegion(m, new ScannerListener() {
         private boolean inTable = true;
 
+        @Override
         @SuppressWarnings("synthetic-access")
         public boolean processRow(HRegionInfo info) throws IOException {
-          LOG.debug("Testing " + Bytes.toString(tableName) + " against " +
-            Bytes.toString(info.getTableDesc().getName()));
+          LOG.debug("Testing " + Bytes.toStringBinary(tableName) + " against "
+              + Bytes.toStringBinary(info.getTableDesc().getName()));
           if (Bytes.equals(info.getTableDesc().getName(), tableName)) {
             this.inTable = false;
             info.getTableDesc().addFamily(hcd);
@@ -371,6 +374,7 @@ public class MetaUtils {
       scanMetaRegion(m, new ScannerListener() {
         private boolean inTable = true;
 
+        @Override
         @SuppressWarnings("synthetic-access")
         public boolean processRow(HRegionInfo info) throws IOException {
           if (Bytes.equals(info.getTableDesc().getName(), tableName)) {
@@ -417,8 +421,9 @@ public class MetaUtils {
       }
       HRegionInfo h = Writables.getHRegionInfoOrNull(value);
 
-      LOG.debug("Old " + Bytes.toString(HConstants.CATALOG_FAMILY) + ":" +
-          Bytes.toString(HConstants.REGIONINFO_QUALIFIER) + " for " +
+      LOG.debug("Old " + Bytes.toStringBinary(HConstants.CATALOG_FAMILY) + ":"
+          + Bytes.toStringBinary(HConstants.REGIONINFO_QUALIFIER) + " for "
+          +
           hri.toString() + " in " + r.toString() + " is: " + h.toString());
     }
 
@@ -440,9 +445,9 @@ public class MetaUtils {
         return;
       }
       HRegionInfo h = Writables.getHRegionInfoOrNull(value);
-        LOG.debug("New " + Bytes.toString(HConstants.CATALOG_FAMILY) + ":" +
-            Bytes.toString(HConstants.REGIONINFO_QUALIFIER) + " for " +
-            hri.toString() + " in " + r.toString() + " is: " +  h.toString());
+      LOG.debug("New " + Bytes.toStringBinary(HConstants.CATALOG_FAMILY) + ":"
+          + Bytes.toStringBinary(HConstants.REGIONINFO_QUALIFIER) + " for "
+          + hri.toString() + " in " + r.toString() + " is: " + h.toString());
     }
   }
 
@@ -465,6 +470,7 @@ public class MetaUtils {
     scanRootRegion(new ScannerListener() {
       private final Log SL_LOG = LogFactory.getLog(this.getClass());
 
+      @Override
       public boolean processRow(HRegionInfo info) throws IOException {
         SL_LOG.debug("Testing " + info);
         if (Bytes.equals(info.getTableDesc().getName(),

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java?rev=1584172&r1=1584171&r2=1584172&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/util/RegionSplitter.java
Wed Apr  2 20:49:37 2014
@@ -453,6 +453,7 @@ public class RegionSplitter {
         // sort the RS by the number of regions they have
         List<String> serversLeft = Lists.newArrayList(daughterRegions .keySet());
         Collections.sort(serversLeft, new Comparator<String>() {
+          @Override
           public int compare(String o1, String o2) {
             return rsSizes.get(o1).compareTo(rsSizes.get(o2));
           }
@@ -725,7 +726,7 @@ public class RegionSplitter {
           end = splitAlgo.lastRow();
         rows.add(Pair.newPair(start, end));
       }
-      LOG.debug("Table " + Bytes.toString(table.getTableName()) + " has "
+      LOG.debug("Table " + Bytes.toStringBinary(table.getTableName()) + " has "
           + rows.size() + " regions that will be split.");
 
       // prepare the split file
@@ -807,6 +808,7 @@ public class RegionSplitter {
     BigInteger lastRowInt = new BigInteger(lastRow, 16);
     int rowComparisonLength = lastRow.length();
 
+    @Override
     public byte[] split(byte[] start, byte[] end) {
       BigInteger s = convertToBigInteger(start);
       BigInteger e = convertToBigInteger(end);
@@ -814,6 +816,7 @@ public class RegionSplitter {
       return convertToByte(split2(s, e));
     }
 
+    @Override
     public byte[][] split(int n) {
       Preconditions.checkArgument(lastRowInt.compareTo(firstRowInt) > 0,
           "last row (%s) is configured less than first row (%s)", lastRow,
@@ -834,19 +837,23 @@ public class RegionSplitter {
       return convertToBytes(splits);
     }
 
+    @Override
     public byte[] firstRow() {
       return convertToByte(firstRowInt);
     }
 
+    @Override
     public byte[] lastRow() {
       return convertToByte(lastRowInt);
     }
 
+    @Override
     public void setFirstRow(String userInput) {
       firstRow = userInput;
       firstRowInt = new BigInteger(firstRow, 16);
     }
 
+    @Override
     public void setLastRow(String userInput) {
       lastRow = userInput;
       lastRowInt = new BigInteger(lastRow, 16);
@@ -854,14 +861,17 @@ public class RegionSplitter {
       rowComparisonLength = lastRow.length();
     }
 
+    @Override
     public byte[] strToRow(String in) {
       return convertToByte(new BigInteger(in, 16));
     }
 
+    @Override
     public String rowToStr(byte[] row) {
       return Bytes.toStringBinary(row);
     }
 
+    @Override
     public String separator() {
       return " ";
     }
@@ -945,6 +955,7 @@ public class RegionSplitter {
     byte[] firstRowBytes = ArrayUtils.EMPTY_BYTE_ARRAY;
     byte[] lastRowBytes =
         new byte[] {xFF, xFF, xFF, xFF, xFF, xFF, xFF, xFF};
+    @Override
     public byte[] split(byte[] start, byte[] end) {
       return Bytes.split(start, end, 1)[1];
     }



Mime
View raw message