HBASE-17087 Enable Aliasing for CodedInputStream created by ByteInputByteString#newCodedInput.

This commit is contained in:
anoopsamjohn 2016-11-15 10:57:41 +05:30
parent 86df89b016
commit 3f1f587266
2 changed files with 17 additions and 1 deletions

View File

@ -244,6 +244,8 @@ final class ByteInputByteString extends ByteString.LeafByteString {
public CodedInputStream newCodedInput() {
// We trust CodedInputStream not to modify the bytes, or to give anyone
// else access to them.
return CodedInputStream.newInstance(buffer, offset, length, true);
CodedInputStream cis = CodedInputStream.newInstance(buffer, offset, length, true);
cis.enableAliasing(true);
return cis;
}
}

View File

@ -0,0 +1,14 @@
diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/ByteInputByteString.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/ByteInputByteString.java
index 1949602..30de4ec 100644
--- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/ByteInputByteString.java
+++ b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/ByteInputByteString.java
@@ -244,6 +244,8 @@ final class ByteInputByteString extends ByteString.LeafByteString {
public CodedInputStream newCodedInput() {
// We trust CodedInputStream not to modify the bytes, or to give anyone
// else access to them.
- return CodedInputStream.newInstance(buffer, offset, length, true);
+ CodedInputStream cis = CodedInputStream.newInstance(buffer, offset, length, true);
+ cis.enableAliasing(true);
+ return cis;
}
}