HBASE-11234 FastDiffDeltaEncoder#getFirstKeyInBlock returns wrong result
This commit is contained in:
parent
41691e469a
commit
edae564856
|
@ -360,7 +360,8 @@ public class FastDiffDeltaEncoder extends BufferedDataBlockEncoder {
|
|||
ByteBufferUtils.readCompressedInt(block); // commonLength
|
||||
int pos = block.position();
|
||||
block.reset();
|
||||
return ByteBuffer.wrap(block.array(), pos, keyLength).slice();
|
||||
return ByteBuffer.wrap(block.array(), block.arrayOffset() + pos, keyLength)
|
||||
.slice();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -137,7 +137,8 @@ public class PrefixKeyDeltaEncoder extends BufferedDataBlockEncoder {
|
|||
}
|
||||
int pos = block.position();
|
||||
block.reset();
|
||||
return ByteBuffer.wrap(block.array(), pos, keyLength).slice();
|
||||
return ByteBuffer.wrap(block.array(), block.arrayOffset() + pos, keyLength)
|
||||
.slice();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.apache.hadoop.hbase.filter.FilterList;
|
|||
import org.apache.hadoop.hbase.filter.FilterList.Operator;
|
||||
import org.apache.hadoop.hbase.filter.PageFilter;
|
||||
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter;
|
||||
import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
|
||||
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
|
||||
import org.apache.hadoop.hbase.io.hfile.HFileContext;
|
||||
import org.apache.hadoop.hbase.io.hfile.HFileContextBuilder;
|
||||
|
@ -88,12 +89,14 @@ public class TestReversibleScanners {
|
|||
TEST_UTIL.getDataTestDir("testReversibleStoreFileScanner"),
|
||||
"regionname"), "familyname");
|
||||
CacheConfig cacheConf = new CacheConfig(TEST_UTIL.getConfiguration());
|
||||
for (DataBlockEncoding encoding : DataBlockEncoding.values()) {
|
||||
HFileContextBuilder hcBuilder = new HFileContextBuilder();
|
||||
hcBuilder.withBlockSize(2 * 1024);
|
||||
hcBuilder.withDataBlockEncoding(encoding);
|
||||
HFileContext hFileContext = hcBuilder.build();
|
||||
StoreFile.Writer writer = new StoreFile.WriterBuilder(
|
||||
TEST_UTIL.getConfiguration(), cacheConf, fs).withOutputDir(
|
||||
hfilePath).withFileContext(hFileContext).build();
|
||||
TEST_UTIL.getConfiguration(), cacheConf, fs).withOutputDir(hfilePath)
|
||||
.withFileContext(hFileContext).build();
|
||||
writeStoreFile(writer);
|
||||
|
||||
StoreFile sf = new StoreFile(fs, writer.getPath(),
|
||||
|
@ -112,6 +115,8 @@ public class TestReversibleScanners {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReversibleMemstoreScanner() throws IOException {
|
||||
MemStore memstore = new DefaultMemStore();
|
||||
|
|
Loading…
Reference in New Issue