hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1304047 - in /hbase/trunk/src/main/java/org/apache/hadoop/hbase: regionserver/HRegionThriftServer.java thrift/ThriftServerRunner.java
Date Thu, 22 Mar 2012 20:43:55 GMT
Author: tedyu
Date: Thu Mar 22 20:43:55 2012
New Revision: 1304047

URL: http://svn.apache.org/viewvc?rev=1304047&view=rev
Log:
HBASE-5591 ThiftServerRunner.HBaseHandler.toBytes() is identical to Bytes.getBytes() (Scott
Chen)

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java?rev=1304047&r1=1304046&r2=1304047&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionThriftServer.java
Thu Mar 22 20:43:55 2012
@@ -19,7 +19,7 @@
  */
 package org.apache.hadoop.hbase.regionserver;
 
-import static org.apache.hadoop.hbase.thrift.ThriftServerRunner.HBaseHandler.toBytes;
+import static org.apache.hadoop.hbase.util.Bytes.getBytes;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -121,9 +121,9 @@ public class HRegionThriftServer extends
                                                 long timestamp,
       Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
       try {
-        byte[] row = toBytes(rowb);
+        byte[] row = getBytes(rowb);
 
-        HTable table = getTable(toBytes(tableName));
+        HTable table = getTable(getBytes(tableName));
         HRegionLocation location = table.getRegionLocation(row, false);
         byte[] regionName = location.getRegionInfo().getRegionName();
 
@@ -135,7 +135,7 @@ public class HRegionThriftServer extends
         }
         Get get = new Get(row);
         for(ByteBuffer column : columns) {
-          byte [][] famAndQf = KeyValue.parseColumn(toBytes(column));
+          byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
           if (famAndQf.length == 1) {
             get.addFamily(famAndQf[0]);
           } else {

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java?rev=1304047&r1=1304046&r2=1304047&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServerRunner.java Thu Mar
22 20:43:55 2012
@@ -585,7 +585,7 @@ public class ThriftServerRunner implemen
     throws IOError {
       try{
         List<HRegionInfo> hris =
-            this.getHBaseAdmin().getTableRegions(toBytes(tableName));
+            this.getHBaseAdmin().getTableRegions(getBytes(tableName));
         List<TRegionInfo> regions = new ArrayList<TRegionInfo>();
 
         if (hris != null) {
@@ -606,18 +606,6 @@ public class ThriftServerRunner implemen
       }
     }
 
-    /**
-     * Convert ByteBuffer to byte array. Note that this cannot be replaced by
-     * Bytes.toBytes().
-     */
-    public static byte[] toBytes(ByteBuffer bb) {
-      byte[] result = new byte[bb.remaining()];
-      // Make a duplicate so the position doesn't change
-      ByteBuffer dup = bb.duplicate();
-      dup.get(result, 0, result.length);
-      return result;
-    }
-
     @Deprecated
     @Override
     public List<TCell> get(
@@ -1349,7 +1337,7 @@ public class ThriftServerRunner implemen
     public TRegionInfo getRegionInfo(ByteBuffer searchRow) throws IOError {
       try {
         HTable table = getTable(HConstants.META_TABLE_NAME);
-        byte[] row = toBytes(searchRow);
+        byte[] row = getBytes(searchRow);
         Result startRowResult = table.getRowOrBefore(
           row, HConstants.CATALOG_FAMILY);
 



Mime
View raw message