HBASE-16758  back HBaseZeroCopyByteStringer stuff.

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

Branch: refs/heads/hbase-12439
Commit: 617dfe18cdc287ea5886e5a9567c9abcd6c0fa28
Parents: 6a9b57b
Author: anoopsamjohn <anoopsamj...@gmail.com>
Authored: Wed Oct 5 12:57:13 2016 +0530
Committer: anoopsamjohn <anoopsamj...@gmail.com>
Committed: Wed Oct 5 12:57:13 2016 +0530

----------------------------------------------------------------------
 .../coprocessor/BigDecimalColumnInterpreter.java   |  5 ++---
 .../hbase/security/access/AccessControlUtil.java   | 17 +++++++++--------
 .../security/visibility/VisibilityClient.java      |  7 ++++---
 .../FanOutOneBlockAsyncDFSOutputSaslHelper.java    |  4 ++--
 .../hadoop/hbase/security/token/TokenUtil.java     |  5 +++--
 .../security/visibility/VisibilityController.java  |  4 ++--
 .../hbase/security/visibility/VisibilityUtils.java |  6 ++----
 7 files changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/617dfe18/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
index 7d08b7e..9036273 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/coprocessor/BigDecimalColumnInterpreter.java
@@ -30,10 +30,9 @@ import 
org.apache.hadoop.hbase.classification.InterfaceStability;
 import org.apache.hadoop.hbase.coprocessor.ColumnInterpreter;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BigDecimalMsg;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.EmptyMsg;
+import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.hadoop.hbase.util.Bytes;
 
-import com.google.protobuf.ByteString;
-
 /**
  * ColumnInterpreter for doing Aggregation's with BigDecimal columns. This 
class
  * is required at the RegionServer also.
@@ -124,7 +123,7 @@ public class BigDecimalColumnInterpreter extends 
ColumnInterpreter<BigDecimal, B
 
   private BigDecimalMsg getProtoForType(BigDecimal t) {
     BigDecimalMsg.Builder builder = BigDecimalMsg.newBuilder();
-    return 
builder.setBigdecimalMsg(ByteString.copyFrom(Bytes.toBytes(t))).build();
+    return 
builder.setBigdecimalMsg(ByteStringer.wrap(Bytes.toBytes(t))).build();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hbase/blob/617dfe18/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
index 325edeb..11c68b3 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlUtil.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos;
 import 
org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.AccessControlService;
 import 
org.apache.hadoop.hbase.protobuf.generated.AccessControlProtos.GetUserPermissionsResponse;
+import org.apache.hadoop.hbase.util.ByteStringer;
 
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.ListMultimap;
@@ -66,10 +67,10 @@ public class AccessControlUtil {
     permissionBuilder.setTableName(ProtobufUtil.toProtoTableName(tableName));
 
     if (family != null) {
-      permissionBuilder.setFamily(ByteString.copyFrom(family));
+      permissionBuilder.setFamily(ByteStringer.wrap(family));
     }
     if (qualifier != null) {
-      permissionBuilder.setQualifier(ByteString.copyFrom(qualifier));
+      permissionBuilder.setQualifier(ByteStringer.wrap(qualifier));
     }
     ret.setType(AccessControlProtos.Permission.Type.Table)
        .setTablePermission(permissionBuilder);
@@ -328,10 +329,10 @@ public class AccessControlUtil {
             AccessControlProtos.TablePermission.newBuilder();
         
builder.setTableName(ProtobufUtil.toProtoTableName(tablePerm.getTableName()));
         if (tablePerm.hasFamily()) {
-          builder.setFamily(ByteString.copyFrom(tablePerm.getFamily()));
+          builder.setFamily(ByteStringer.wrap(tablePerm.getFamily()));
         }
         if (tablePerm.hasQualifier()) {
-          builder.setQualifier(ByteString.copyFrom(tablePerm.getQualifier()));
+          builder.setQualifier(ByteStringer.wrap(tablePerm.getQualifier()));
         }
         Permission.Action actions[] = perm.getActions();
         if (actions != null) {
@@ -427,7 +428,7 @@ public class AccessControlUtil {
    */
   public static AccessControlProtos.UserPermission 
toUserPermission(UserPermission perm) {
     return AccessControlProtos.UserPermission.newBuilder()
-        .setUser(ByteString.copyFrom(perm.getUser()))
+        .setUser(ByteStringer.wrap(perm.getUser()))
         .setPermission(toPermission(perm))
         .build();
   }
@@ -691,7 +692,7 @@ public class AccessControlUtil {
     AccessControlProtos.GetUserPermissionsRequest.Builder builder =
         AccessControlProtos.GetUserPermissionsRequest.newBuilder();
     if (namespace != null) {
-      builder.setNamespaceName(ByteString.copyFrom(namespace));
+      builder.setNamespaceName(ByteStringer.wrap(namespace));
     }
     builder.setType(AccessControlProtos.Permission.Type.Namespace);
     AccessControlProtos.GetUserPermissionsRequest request = builder.build();
@@ -749,10 +750,10 @@ public class AccessControlUtil {
       permissionBuilder.setTableName(ProtobufUtil.toProtoTableName(tableName));
     }
     if (family != null) {
-      permissionBuilder.setFamily(ByteString.copyFrom(family));
+      permissionBuilder.setFamily(ByteStringer.wrap(family));
     }
     if (qualifier != null) {
-      permissionBuilder.setQualifier(ByteString.copyFrom(qualifier));
+      permissionBuilder.setQualifier(ByteStringer.wrap(qualifier));
     }
     ret.setType(AccessControlProtos.Permission.Type.Table)
     .setTablePermission(permissionBuilder);

http://git-wip-us.apache.org/repos/asf/hbase/blob/617dfe18/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
----------------------------------------------------------------------
diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
index f6f2dd1..cd153f1 100644
--- 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
+++ 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java
@@ -43,6 +43,7 @@ import 
org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.Visibil
 import 
org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsRequest;
 import 
org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsResponse;
 import 
org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsService;
+import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.hadoop.hbase.util.Bytes;
 
 import com.google.protobuf.ByteString;
@@ -137,7 +138,7 @@ public class VisibilityClient {
               for (String label : labels) {
                 if (label.length() > 0) {
                   VisibilityLabel.Builder newBuilder = 
VisibilityLabel.newBuilder();
-                  
newBuilder.setLabel(ByteString.copyFrom(Bytes.toBytes(label)));
+                  newBuilder.setLabel(ByteStringer.wrap(Bytes.toBytes(label)));
                   builder.addVisLabel(newBuilder.build());
                 }
               }
@@ -218,7 +219,7 @@ public class VisibilityClient {
 
           public GetAuthsResponse call(VisibilityLabelsService service) throws 
IOException {
             GetAuthsRequest.Builder getAuthReqBuilder = 
GetAuthsRequest.newBuilder();
-            
getAuthReqBuilder.setUser(ByteString.copyFrom(Bytes.toBytes(user)));
+            getAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user)));
             service.getAuths(controller, getAuthReqBuilder.build(), 
rpcCallback);
             GetAuthsResponse response = rpcCallback.get();
             if (controller.failedOnException()) {
@@ -343,7 +344,7 @@ public class VisibilityClient {
 
           public VisibilityLabelsResponse call(VisibilityLabelsService 
service) throws IOException {
             SetAuthsRequest.Builder setAuthReqBuilder = 
SetAuthsRequest.newBuilder();
-            
setAuthReqBuilder.setUser(ByteString.copyFrom(Bytes.toBytes(user)));
+            setAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user)));
             for (String auth : auths) {
               if (auth.length() > 0) {
                 setAuthReqBuilder.addAuth((ByteString.copyFromUtf8(auth)));

http://git-wip-us.apache.org/repos/asf/hbase/blob/617dfe18/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputSaslHelper.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputSaslHelper.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputSaslHelper.java
index 0546253..a222e1b 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputSaslHelper.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutputSaslHelper.java
@@ -25,7 +25,6 @@ import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.google.protobuf.ByteString;
 import com.google.protobuf.CodedOutputStream;
 
 import io.netty.buffer.ByteBuf;
@@ -78,6 +77,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
+import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.hadoop.hdfs.DFSClient;
 import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
 import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
@@ -754,7 +754,7 @@ public final class FanOutOneBlockAsyncDFSOutputSaslHelper {
           .newBuilder();
       builder.setStatus(DataTransferEncryptorStatus.SUCCESS);
       if (payload != null) {
-        builder.setPayload(ByteString.copyFrom(payload));
+        builder.setPayload(ByteStringer.wrap(payload));
       }
       if (options != null) {
         CIPHER_OPTION_HELPER.addCipherOptions(builder, options);

http://git-wip-us.apache.org/repos/asf/hbase/blob/617dfe18/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
index 293c512..f767ed3 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/TokenUtil.java
@@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
 import org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos;
 import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
+import org.apache.hadoop.hbase.util.ByteStringer;
 import org.apache.hadoop.hbase.zookeeper.ZKClusterId;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
 import org.apache.hadoop.io.Text;
@@ -91,8 +92,8 @@ public class TokenUtil {
    */
   public static AuthenticationProtos.Token 
toToken(Token<AuthenticationTokenIdentifier> token) {
     AuthenticationProtos.Token.Builder builder = 
AuthenticationProtos.Token.newBuilder();
-    builder.setIdentifier(ByteString.copyFrom(token.getIdentifier()));
-    builder.setPassword(ByteString.copyFrom(token.getPassword()));
+    builder.setIdentifier(ByteStringer.wrap(token.getIdentifier()));
+    builder.setPassword(ByteStringer.wrap(token.getPassword()));
     if (token.getService() != null) {
       
builder.setService(ByteString.copyFromUtf8(token.getService().toString()));
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/617dfe18/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
index d546b50..e7c75fc 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java
@@ -941,7 +941,7 @@ public class VisibilityController extends 
BaseMasterAndRegionObserver implements
       response.setUser(request.getUser());
       if (labels != null) {
         for (String label : labels) {
-          response.addAuth(ByteString.copyFrom(Bytes.toBytes(label)));
+          response.addAuth(ByteStringer.wrap(Bytes.toBytes(label)));
         }
       }
     }
@@ -1029,7 +1029,7 @@ public class VisibilityController extends 
BaseMasterAndRegionObserver implements
       }
       if (labels != null && !labels.isEmpty()) {
         for (String label : labels) {
-          response.addLabel(ByteString.copyFrom(Bytes.toBytes(label)));
+          response.addLabel(ByteStringer.wrap(Bytes.toBytes(label)));
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/617dfe18/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityUtils.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityUtils.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityUtils.java
index caebb3f..1db506d 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityUtils.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityUtils.java
@@ -65,8 +65,6 @@ import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.SimpleMutableByteRange;
 import org.apache.hadoop.util.ReflectionUtils;
 
-import com.google.protobuf.ByteString;
-
 /**
  * Utility method to support visibility
  */
@@ -95,7 +93,7 @@ public class VisibilityUtils {
     VisibilityLabelsRequest.Builder visReqBuilder = 
VisibilityLabelsRequest.newBuilder();
     for (Entry<String, Integer> entry : existingLabels.entrySet()) {
       VisibilityLabel.Builder visLabBuilder = VisibilityLabel.newBuilder();
-      
visLabBuilder.setLabel(ByteString.copyFrom(Bytes.toBytes(entry.getKey())));
+      visLabBuilder.setLabel(ByteStringer.wrap(Bytes.toBytes(entry.getKey())));
       visLabBuilder.setOrdinal(entry.getValue());
       visReqBuilder.addVisLabel(visLabBuilder.build());
     }
@@ -111,7 +109,7 @@ public class VisibilityUtils {
     MultiUserAuthorizations.Builder builder = 
MultiUserAuthorizations.newBuilder();
     for (Entry<String, List<Integer>> entry : userAuths.entrySet()) {
       UserAuthorizations.Builder userAuthsBuilder = 
UserAuthorizations.newBuilder();
-      
userAuthsBuilder.setUser(ByteString.copyFrom(Bytes.toBytes(entry.getKey())));
+      
userAuthsBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(entry.getKey())));
       for (Integer label : entry.getValue()) {
         userAuthsBuilder.addAuth(label);
       }

Reply via email to