This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new 9515b22  HBASE-25674 - RegionInfo.parseFrom(DataInputStream) sometimes 
fails to read the protobuf magic marker (#3062)
9515b22 is described below

commit 9515b22f45bbb999677b4f6b0148f7f71fdd8486
Author: Catalin Luca <catalin.luc...@gmail.com>
AuthorDate: Thu Mar 18 20:56:04 2021 +0200

    HBASE-25674 - RegionInfo.parseFrom(DataInputStream) sometimes fails to read 
the protobuf magic marker (#3062)
    
    Co-authored-by: Catalin Luca <l...@adobe.com>
    Signed-off-by: stack <st...@apache.org>
---
 .../src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java 
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
index 5882d0f..2ce3d7d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionInfo.java
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.util.HashKey;
 import org.apache.hadoop.hbase.util.JenkinsHash;
 import org.apache.hadoop.hbase.util.MD5Hash;
 import org.apache.hadoop.io.DataInputBuffer;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
@@ -744,8 +745,7 @@ public interface RegionInfo extends Comparable<RegionInfo> {
     }
 
     //assumption: if Writable serialization, it should be longer than pblen.
-    int read = in.read(pbuf);
-    if (read != pblen) throw new IOException("read=" + read + ", wanted=" + 
pblen);
+    IOUtils.readFully(in, pbuf, 0, pblen);
     if (ProtobufUtil.isPBMagicPrefix(pbuf)) {
       return 
ProtobufUtil.toRegionInfo(HBaseProtos.RegionInfo.parseDelimitedFrom(in));
     } else {

Reply via email to