diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java index feddc2c..ea01f76 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java @@ -834,7 +834,9 @@ public class HFile { int read = in.read(pbuf); if (read != pblen) throw new IOException("read=" + read + ", wanted=" + pblen); if (ProtobufUtil.isPBMagicPrefix(pbuf)) { - parsePB(HFileProtos.FileInfoProto.parseDelimitedFrom(in)); + HFileProtos.FileInfoProto.Builder builder = HFileProtos.FileInfoProto.newBuilder(); + ProtobufUtil.mergeDelimitedFrom(builder, in); + parsePB(builder.build()); } else { if (in.markSupported()) { in.reset(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java index b938f7e..84ae967 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java @@ -22,6 +22,8 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.io.InterruptedIOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HConstants; @@ -48,7 +50,7 @@ import org.junit.rules.TestName; */ @Category({LargeTests.class, ClientTests.class}) public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient { - + private static final Log LOG = LogFactory.getLog(TestMobCloneSnapshotFromClient.class); private static boolean delayFlush = false; @Rule @@ -58,6 +60,8 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient TestCloneSnapshotFromClient.setupConfiguration(); TEST_UTIL.getConfiguration().setLong(TimeToLiveHFileCleaner.TTL_CONF_KEY, 0); TEST_UTIL.getConfiguration().setInt(MobConstants.MOB_FILE_CACHE_SIZE_KEY, 0); + TEST_UTIL.getConfiguration().setInt(ConnectionConfiguration.MAX_KEYVALUE_SIZE_KEY, 1<<26+1); + TEST_UTIL.getConfiguration().setInt("hbase.server.keyvalue.maxsize", 1<<26+1); } @BeforeClass @@ -71,13 +75,22 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient // create Table and disable it createMobTable(TEST_UTIL, tableName, SnapshotTestingUtils.getSplitKeys(), getNumReplicas(), FAMILY); + Connection c = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); + Table tbl = c.getTable(tableName); + byte[] data = new byte[1<<26]; + byte[] smalldata = new byte[1]; + Put put = new Put(Bytes.toBytes("1")); + put.addColumn(FAMILY, data, smalldata); + tbl.put(put); + tbl.close(); + LOG.info("written large put"); + delayFlush = false; admin.disableTable(tableName); // take an empty snapshot admin.snapshot(emptySnapshot, tableName); - Connection c = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Table table = c.getTable(tableName); try { // enable table and insert data