HBASE-25674 - RegionInfo.parseFrom(DataInputStream) sometimes fails to read the protobuf magic marker (#3062)
Co-authored-by: Catalin Luca <luca@adobe.com> Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
7ac1c8bbf8
commit
3ebb97807e
|
@ -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;
|
||||
|
@ -752,8 +753,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 {
|
||||
|
|
Loading…
Reference in New Issue