HBASE-18927 Add the DataType which is subset of KeyValue#Type to CellBuilder for building cell

This commit is contained in:
Chia-Ping Tsai 2017-10-04 01:57:08 +08:00
parent 2f2513255d
commit 11aa6742f0
15 changed files with 67 additions and 36 deletions

View File

@ -31,8 +31,6 @@ import java.util.function.Function;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilder;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.CellUtil;
@ -1328,7 +1326,7 @@ public final class ProtobufUtil {
} }
List<Cell> cells = new ArrayList<>(values.size()); List<Cell> cells = new ArrayList<>(values.size());
CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); ExtendedCellBuilder builder = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
for (CellProtos.Cell c : values) { for (CellProtos.Cell c : values) {
cells.add(toCell(builder, c)); cells.add(toCell(builder, c));
} }
@ -1371,7 +1369,7 @@ public final class ProtobufUtil {
if (!values.isEmpty()){ if (!values.isEmpty()){
if (cells == null) cells = new ArrayList<>(values.size()); if (cells == null) cells = new ArrayList<>(values.size());
CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); ExtendedCellBuilder builder = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
for (CellProtos.Cell c: values) { for (CellProtos.Cell c: values) {
cells.add(toCell(builder, c)); cells.add(toCell(builder, c));
} }
@ -1632,7 +1630,7 @@ public final class ProtobufUtil {
return kvbuilder.build(); return kvbuilder.build();
} }
public static Cell toCell(CellBuilder cellBuilder, final CellProtos.Cell cell) { public static Cell toCell(ExtendedCellBuilder cellBuilder, final CellProtos.Cell cell) {
return cellBuilder.clear() return cellBuilder.clear()
.setRow(cell.getRow().toByteArray()) .setRow(cell.getRow().toByteArray())
.setFamily(cell.getFamily().toByteArray()) .setFamily(cell.getFamily().toByteArray())

View File

@ -1493,7 +1493,7 @@ public final class ProtobufUtil {
} }
List<Cell> cells = new ArrayList<>(values.size()); List<Cell> cells = new ArrayList<>(values.size());
CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); ExtendedCellBuilder builder = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
for (CellProtos.Cell c : values) { for (CellProtos.Cell c : values) {
cells.add(toCell(builder, c)); cells.add(toCell(builder, c));
} }
@ -1536,7 +1536,7 @@ public final class ProtobufUtil {
if (!values.isEmpty()){ if (!values.isEmpty()){
if (cells == null) cells = new ArrayList<>(values.size()); if (cells == null) cells = new ArrayList<>(values.size());
CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); ExtendedCellBuilder builder = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
for (CellProtos.Cell c: values) { for (CellProtos.Cell c: values) {
cells.add(toCell(builder, c)); cells.add(toCell(builder, c));
} }
@ -2043,7 +2043,7 @@ public final class ProtobufUtil {
return UnsafeByteOperations.unsafeWrap(dup); return UnsafeByteOperations.unsafeWrap(dup);
} }
public static Cell toCell(CellBuilder cellBuilder, final CellProtos.Cell cell) { public static Cell toCell(ExtendedCellBuilder cellBuilder, final CellProtos.Cell cell) {
return cellBuilder.clear() return cellBuilder.clear()
.setRow(cell.getRow().toByteArray()) .setRow(cell.getRow().toByteArray())
.setFamily(cell.getFamily().toByteArray()) .setFamily(cell.getFamily().toByteArray())

View File

@ -25,9 +25,9 @@ import java.nio.ByteBuffer;
import org.apache.hadoop.hbase.ByteBufferKeyValue; import org.apache.hadoop.hbase.ByteBufferKeyValue;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.ExtendedCellBuilderFactory;
import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Append; import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Delete;
@ -260,7 +260,7 @@ public class TestProtobufUtil {
dbb.put(arr); dbb.put(arr);
ByteBufferKeyValue offheapKV = new ByteBufferKeyValue(dbb, kv1.getLength(), kv2.getLength()); ByteBufferKeyValue offheapKV = new ByteBufferKeyValue(dbb, kv1.getLength(), kv2.getLength());
CellProtos.Cell cell = ProtobufUtil.toCell(offheapKV); CellProtos.Cell cell = ProtobufUtil.toCell(offheapKV);
Cell newOffheapKV = ProtobufUtil.toCell(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), cell); Cell newOffheapKV = ProtobufUtil.toCell(ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), cell);
assertTrue(CellComparator.COMPARATOR.compare(offheapKV, newOffheapKV) == 0); assertTrue(CellComparator.COMPARATOR.compare(offheapKV, newOffheapKV) == 0);
} }

View File

@ -26,6 +26,18 @@ import org.apache.yetus.audience.InterfaceAudience;
@InterfaceAudience.Public @InterfaceAudience.Public
public interface CellBuilder { public interface CellBuilder {
/**
* The valid types for user to build the cell.
* Currently, This is subset of {@link KeyValue.Type}.
*/
enum DataType {
Put,
Delete,
DeleteFamilyVersion,
DeleteColumn,
DeleteFamily
}
CellBuilder setRow(final byte[] row); CellBuilder setRow(final byte[] row);
CellBuilder setRow(final byte[] row, final int rOffset, final int rLength); CellBuilder setRow(final byte[] row, final int rOffset, final int rLength);
@ -37,7 +49,7 @@ public interface CellBuilder {
CellBuilder setTimestamp(final long timestamp); CellBuilder setTimestamp(final long timestamp);
CellBuilder setType(final byte type); CellBuilder setType(final DataType type);
CellBuilder setValue(final byte[] value); CellBuilder setValue(final byte[] value);
CellBuilder setValue(final byte[] value, final int vOffset, final int vLength); CellBuilder setValue(final byte[] value, final int vOffset, final int vLength);

View File

@ -372,7 +372,7 @@ public final class CellUtil {
@Deprecated @Deprecated
public static Cell createCell(final byte [] row, final byte [] family, final byte [] qualifier, public static Cell createCell(final byte [] row, final byte [] family, final byte [] qualifier,
final long timestamp, final byte type, final byte [] value) { final long timestamp, final byte type, final byte [] value) {
return CellBuilderFactory.create(CellBuilderType.DEEP_COPY) return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY)
.setRow(row) .setRow(row)
.setFamily(family) .setFamily(family)
.setQualifier(qualifier) .setQualifier(qualifier)
@ -392,7 +392,7 @@ public final class CellUtil {
final byte [] familyArray, final int familyOffset, final int familyLength, final byte [] familyArray, final int familyOffset, final int familyLength,
final byte [] qualifierArray, final int qualifierOffset, final int qualifierLength) { final byte [] qualifierArray, final int qualifierOffset, final int qualifierLength) {
// See createCell(final byte [] row, final byte [] value) for why we default Maximum type. // See createCell(final byte [] row, final byte [] value) for why we default Maximum type.
return CellBuilderFactory.create(CellBuilderType.DEEP_COPY) return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY)
.setRow(rowArray, rowOffset, rowLength) .setRow(rowArray, rowOffset, rowLength)
.setFamily(familyArray, familyOffset, familyLength) .setFamily(familyArray, familyOffset, familyLength)
.setQualifier(qualifierArray, qualifierOffset, qualifierLength) .setQualifier(qualifierArray, qualifierOffset, qualifierLength)

View File

@ -47,6 +47,8 @@ public interface ExtendedCellBuilder extends CellBuilder {
ExtendedCellBuilder setTimestamp(final long timestamp); ExtendedCellBuilder setTimestamp(final long timestamp);
@Override @Override
ExtendedCellBuilder setType(final DataType type);
ExtendedCellBuilder setType(final byte type); ExtendedCellBuilder setType(final byte type);
@Override @Override

View File

@ -32,7 +32,7 @@ public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder {
protected int qOffset = 0; protected int qOffset = 0;
protected int qLength = 0; protected int qLength = 0;
protected long timestamp = HConstants.LATEST_TIMESTAMP; protected long timestamp = HConstants.LATEST_TIMESTAMP;
protected Byte type = null; protected KeyValue.Type type = null;
protected byte[] value = null; protected byte[] value = null;
protected int vOffset = 0; protected int vOffset = 0;
protected int vLength = 0; protected int vLength = 0;
@ -86,9 +86,15 @@ public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder {
return this; return this;
} }
@Override
public ExtendedCellBuilder setType(final DataType type) {
this.type = toKeyValueType(type);
return this;
}
@Override @Override
public ExtendedCellBuilder setType(final byte type) { public ExtendedCellBuilder setType(final byte type) {
this.type = type; this.type = KeyValue.Type.codeToType(type);
return this; return this;
} }
@ -160,4 +166,15 @@ public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder {
tagsLength = 0; tagsLength = 0;
return this; return this;
} }
private static KeyValue.Type toKeyValueType(DataType type) {
switch (type) {
case Put: return KeyValue.Type.Put;
case Delete: return KeyValue.Type.Delete;
case DeleteColumn: return KeyValue.Type.DeleteColumn;
case DeleteFamilyVersion: return KeyValue.Type.DeleteFamilyVersion;
case DeleteFamily: return KeyValue.Type.DeleteFamily;
default: throw new UnsupportedOperationException("Unsupported data type:" + type);
}
}
} }

View File

@ -26,7 +26,7 @@ class IndividualBytesFieldCellBuilder extends ExtendedCellBuilderImpl {
return new IndividualBytesFieldCell(row, rOffset, rLength, return new IndividualBytesFieldCell(row, rOffset, rLength,
family, fOffset, fLength, family, fOffset, fLength,
qualifier, qOffset, qLength, qualifier, qOffset, qLength,
timestamp, KeyValue.Type.codeToType(type), seqId, timestamp, type, seqId,
value, vOffset, vLength, value, vOffset, vLength,
tags, tagsOffset, tagsLength); tags, tagsOffset, tagsLength);
} }

View File

@ -26,7 +26,7 @@ class KeyValueBuilder extends ExtendedCellBuilderImpl {
KeyValue kv = new KeyValue(row, rOffset, rLength, KeyValue kv = new KeyValue(row, rOffset, rLength,
family, fOffset, fLength, family, fOffset, fLength,
qualifier, qOffset, qLength, qualifier, qOffset, qLength,
timestamp, KeyValue.Type.codeToType(type), timestamp, type,
value, vOffset, vLength, value, vOffset, vLength,
tags, tagsOffset, tagsLength); tags, tagsOffset, tagsLength);
kv.setSequenceId(seqId); kv.setSequenceId(seqId);

View File

@ -41,7 +41,7 @@ public class TestCellBuilder {
.setRow(row) .setRow(row)
.setFamily(family) .setFamily(family)
.setQualifier(qualifier) .setQualifier(qualifier)
.setType(KeyValue.Type.Put.getCode()) .setType(CellBuilder.DataType.Put)
.setValue(value) .setValue(value)
.build(); .build();
row[0] = NEW_DATA; row[0] = NEW_DATA;
@ -64,7 +64,7 @@ public class TestCellBuilder {
.setRow(row) .setRow(row)
.setFamily(family) .setFamily(family)
.setQualifier(qualifier) .setQualifier(qualifier)
.setType(KeyValue.Type.Put.getCode()) .setType(CellBuilder.DataType.Put)
.setValue(value) .setValue(value)
.build(); .build();
row[0] = NEW_DATA; row[0] = NEW_DATA;

View File

@ -21,9 +21,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.ExtendedCellBuilderFactory;
import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.testclassification.MiscTests; import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.testclassification.SmallTests; import org.apache.hadoop.hbase.testclassification.SmallTests;
@ -54,6 +54,6 @@ public class TestPBCell {
pbr.setPosition(0); pbr.setPosition(0);
decoded = CODEC.decode(pbr); decoded = CODEC.decode(pbr);
assertEquals(encodedLength, pbr.getPosition()); assertEquals(encodedLength, pbr.getPosition());
assertTrue(CellUtil.equals(cell, ProtobufUtil.toCell(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), decoded))); assertTrue(CellUtil.equals(cell, ProtobufUtil.toCell(ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), decoded)));
} }
} }

View File

@ -25,20 +25,20 @@ import java.util.List;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilder;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor; import org.apache.hadoop.hbase.ExtendedCellBuilder;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.StoreDescriptor; import org.apache.hadoop.hbase.ExtendedCellBuilderFactory;
import org.apache.hadoop.hbase.wal.WALEdit; import org.apache.hadoop.hbase.wal.WALEdit;
import org.apache.hadoop.hbase.shaded.com.google.common.base.Predicate; import org.apache.hadoop.hbase.shaded.com.google.common.base.Predicate;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.BulkLoadDescriptor;
import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.StoreDescriptor;
public class BulkLoadCellFilter { public class BulkLoadCellFilter {
private static final Log LOG = LogFactory.getLog(BulkLoadCellFilter.class); private static final Log LOG = LogFactory.getLog(BulkLoadCellFilter.class);
private final CellBuilder cellBuilder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); private final ExtendedCellBuilder cellBuilder = ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY);
/** /**
* Filters the bulk load cell using the supplied predicate. * Filters the bulk load cell using the supplied predicate.
* @param cell The WAL cell to filter. * @param cell The WAL cell to filter.

View File

@ -24,9 +24,9 @@ import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.ExtendedCellBuilderFactory;
import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.ByteBufferKeyValue; import org.apache.hadoop.hbase.ByteBufferKeyValue;
import org.apache.hadoop.hbase.client.Append; import org.apache.hadoop.hbase.client.Append;
@ -333,7 +333,7 @@ public class TestProtobufUtil {
dbb.put(arr); dbb.put(arr);
ByteBufferKeyValue offheapKV = new ByteBufferKeyValue(dbb, kv1.getLength(), kv2.getLength()); ByteBufferKeyValue offheapKV = new ByteBufferKeyValue(dbb, kv1.getLength(), kv2.getLength());
CellProtos.Cell cell = ProtobufUtil.toCell(offheapKV); CellProtos.Cell cell = ProtobufUtil.toCell(offheapKV);
Cell newOffheapKV = ProtobufUtil.toCell(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), cell); Cell newOffheapKV = ProtobufUtil.toCell(ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), cell);
assertTrue(CellComparator.COMPARATOR.compare(offheapKV, newOffheapKV) == 0); assertTrue(CellComparator.COMPARATOR.compare(offheapKV, newOffheapKV) == 0);
} }
} }

View File

@ -26,6 +26,7 @@ import java.util.TreeMap;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilder;
import org.apache.hadoop.hbase.CellBuilderFactory; import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -191,7 +192,7 @@ public class MockHStoreFile extends HStoreFile {
public Optional<Cell> getLastKey() { public Optional<Cell> getLastKey() {
if (splitPoint != null) { if (splitPoint != null) {
return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY) return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY)
.setType(KeyValue.Type.Put.getCode()) .setType(CellBuilder.DataType.Put)
.setRow(Arrays.copyOf(splitPoint, splitPoint.length + 1)).build()); .setRow(Arrays.copyOf(splitPoint, splitPoint.length + 1)).build());
} else { } else {
return Optional.empty(); return Optional.empty();
@ -202,7 +203,7 @@ public class MockHStoreFile extends HStoreFile {
public Optional<Cell> midKey() throws IOException { public Optional<Cell> midKey() throws IOException {
if (splitPoint != null) { if (splitPoint != null) {
return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY) return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY)
.setType(KeyValue.Type.Put.getCode()).setRow(splitPoint).build()); .setType(CellBuilder.DataType.Put).setRow(splitPoint).build());
} else { } else {
return Optional.empty(); return Optional.empty();
} }
@ -212,7 +213,7 @@ public class MockHStoreFile extends HStoreFile {
public Optional<Cell> getFirstKey() { public Optional<Cell> getFirstKey() {
if (splitPoint != null) { if (splitPoint != null) {
return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY) return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY)
.setType(KeyValue.Type.Put.getCode()).setRow(splitPoint, 0, splitPoint.length - 1) .setType(CellBuilder.DataType.Put).setRow(splitPoint, 0, splitPoint.length - 1)
.build()); .build());
} else { } else {
return Optional.empty(); return Optional.empty();

View File

@ -59,6 +59,7 @@ import org.apache.hadoop.fs.LocalFileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilder;
import org.apache.hadoop.hbase.CellBuilderFactory; import org.apache.hadoop.hbase.CellBuilderFactory;
import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.CellComparator;
@ -1014,13 +1015,13 @@ public class TestHStore {
long seqId = 100; long seqId = 100;
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
Cell cell0 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family) Cell cell0 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family)
.setQualifier(qf1).setTimestamp(timestamp).setType(KeyValue.Type.Put.getCode()) .setQualifier(qf1).setTimestamp(timestamp).setType(CellBuilder.DataType.Put)
.setValue(qf1).build(); .setValue(qf1).build();
CellUtil.setSequenceId(cell0, seqId); CellUtil.setSequenceId(cell0, seqId);
testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Collections.emptyList()); testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Collections.emptyList());
Cell cell1 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family) Cell cell1 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family)
.setQualifier(qf2).setTimestamp(timestamp).setType(KeyValue.Type.Put.getCode()) .setQualifier(qf2).setTimestamp(timestamp).setType(CellBuilder.DataType.Put)
.setValue(qf1).build(); .setValue(qf1).build();
CellUtil.setSequenceId(cell1, seqId); CellUtil.setSequenceId(cell1, seqId);
testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Arrays.asList(cell1)); testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Arrays.asList(cell1));
@ -1028,7 +1029,7 @@ public class TestHStore {
seqId = 101; seqId = 101;
timestamp = System.currentTimeMillis(); timestamp = System.currentTimeMillis();
Cell cell2 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row2).setFamily(family) Cell cell2 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row2).setFamily(family)
.setQualifier(qf2).setTimestamp(timestamp).setType(KeyValue.Type.Put.getCode()) .setQualifier(qf2).setTimestamp(timestamp).setType(CellBuilder.DataType.Put)
.setValue(qf1).build(); .setValue(qf1).build();
CellUtil.setSequenceId(cell2, seqId); CellUtil.setSequenceId(cell2, seqId);
testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Arrays.asList(cell1, cell2)); testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Arrays.asList(cell1, cell2));
@ -1081,7 +1082,7 @@ public class TestHStore {
private Cell createCell(byte[] row, byte[] qualifier, long ts, long sequenceId, byte[] value) private Cell createCell(byte[] row, byte[] qualifier, long ts, long sequenceId, byte[] value)
throws IOException { throws IOException {
Cell c = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family) Cell c = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family)
.setQualifier(qualifier).setTimestamp(ts).setType(KeyValue.Type.Put.getCode()) .setQualifier(qualifier).setTimestamp(ts).setType(CellBuilder.DataType.Put)
.setValue(value).build(); .setValue(value).build();
CellUtil.setSequenceId(c, sequenceId); CellUtil.setSequenceId(c, sequenceId);
return c; return c;