diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java index b23677b..ef8e219 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/KeyOnlyFilter.java @@ -193,6 +193,11 @@ public class KeyOnlyFilter extends FilterBase { } @Override + public DataType getType() { + return cell.getType(); + } + + @Override public long getSequenceId() { return 0; } @@ -306,6 +311,11 @@ public class KeyOnlyFilter extends FilterBase { } @Override + public DataType getType() { + return cell.getType(); + } + + @Override public byte[] getValueArray() { if (lenAsVal) { return Bytes.toBytes(cell.getValueLength()); diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestHBaseRpcControllerImpl.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestHBaseRpcControllerImpl.java index 0ec78ad..bfd1eb9 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestHBaseRpcControllerImpl.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/ipc/TestHBaseRpcControllerImpl.java @@ -177,6 +177,12 @@ public class TestHBaseRpcControllerImpl { // unused return null; } + + @Override + public DataType getType() { + // unused + return null; + } }; } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyOnlyKeyValue.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyOnlyKeyValue.java index 8a4b720..c855538 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyOnlyKeyValue.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyOnlyKeyValue.java @@ -148,6 +148,11 @@ public class ByteBufferKeyOnlyKeyValue extends ByteBufferCell { } @Override + public DataType getType() { + return PrivateCellUtil.toDataType(getTypeByte()); + } + + @Override public long getSequenceId() { return 0; } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyValue.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyValue.java index cd66312..6cb891c 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyValue.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ByteBufferKeyValue.java @@ -20,6 +20,8 @@ package org.apache.hadoop.hbase; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.util.List; +import java.util.Optional; import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.util.ByteBufferUtils; @@ -343,4 +345,14 @@ public class ByteBufferKeyValue extends ByteBufferCell implements ExtendedCell { hash = 31 * hash + cell.getTypeByte(); return hash; } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java index 2b99823..e041ef0 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/Cell.java @@ -133,8 +133,7 @@ public interface Cell { /** * @return The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc - * @deprecated since 2.0.0, use appropriate {@link CellUtil#isDelete} or - * {@link CellUtil#isPut(Cell)} methods instead. This will be removed in 3.0.0. + * @deprecated As of HBase-2.0. Will be removed in HBase-3.0. Use {@link #getType()}. */ @Deprecated byte getTypeByte(); @@ -148,7 +147,9 @@ public interface Cell { * {@link HConstants#KEEP_SEQID_PERIOD} days, but generally becomes irrelevant after the cell's * row is no longer involved in any operations that require strict consistency. * @return seqId (always > 0 if exists), or 0 if it no longer exists + * @deprecated As of HBase-2.0. Will be removed in HBase-3.0. */ + @Deprecated long getSequenceId(); //7) Value @@ -173,12 +174,18 @@ public interface Cell { /** * Contiguous raw bytes representing tags that may start at any index in the containing array. * @return the tags byte array + * @deprecated As of HBase-2.0. Will be removed in HBase-3.0. + * Use Tag related APIs in {@link RawCell} */ + @Deprecated byte[] getTagsArray(); /** * @return the first offset where the tags start in the Cell + * @deprecated As of HBase-2.0. Will be removed in HBase-3.0. + * Use Tag related APIs in {@link RawCell} */ + @Deprecated int getTagsOffset(); /** @@ -190,6 +197,30 @@ public interface Cell { * less than Integer.MAX_VALUE. * * @return the total length of the tags in the Cell. + * @deprecated As of HBase-2.0. Will be removed in HBase-3.0. + * Use Tag related APIs in {@link RawCell} */ + @Deprecated int getTagsLength(); + + /** + * Returns the type of cell in a human readable format using {@link DataType} + * @return The data type this cell: one of Put, Delete, etc + */ + DataType getType(); + + /** + * The valid types for user to build the cell. Currently, This is subset of {@link KeyValue.Type}. + */ + public enum DataType { + Put, + + Delete, + + DeleteFamilyVersion, + + DeleteColumn, + + DeleteFamily; + } } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellBuilder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellBuilder.java index aeff15a..e89ac37 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellBuilder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellBuilder.java @@ -26,18 +26,6 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Public 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, final int rOffset, final int rLength); @@ -49,7 +37,7 @@ public interface CellBuilder { CellBuilder setTimestamp(final long timestamp); - CellBuilder setType(final DataType type); + CellBuilder setType(final Cell.DataType type); CellBuilder setValue(final byte[] value); CellBuilder setValue(final byte[] value, final int vOffset, final int vLength); diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java index 0940e63..2059547 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/CellUtil.java @@ -563,40 +563,33 @@ public final class CellUtil { * Note : Now only CPs can create cell with tags using the CP environment * @return A new cell which is having the extra tags also added to it. * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. - * Use CP environment to build Cell using {@link ExtendedCellBuilder} + * Use CP environment to build Cell using {@link RawCellBuilder} * */ @Deprecated public static Cell createCell(Cell cell, List tags) { - return createCell(cell, Tag.fromList(tags)); + return PrivateCellUtil.createCell(cell, tags); } /** * Now only CPs can create cell with tags using the CP environment * @return A new cell which is having the extra tags also added to it. * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. - * Use CP environment to build Cell using {@link ExtendedCellBuilder} + * Use CP environment to build Cell using {@link RawCellBuilder} */ @Deprecated public static Cell createCell(Cell cell, byte[] tags) { - if (cell instanceof ByteBufferCell) { - return new PrivateCellUtil.TagRewriteByteBufferCell((ByteBufferCell) cell, tags); - } - return new PrivateCellUtil.TagRewriteCell(cell, tags); + return PrivateCellUtil.createCell(cell, tags); } /** * Now only CPs can create cell with tags using the CP environment * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. - * Use CP environment to build Cell using {@link ExtendedCellBuilder} + * Use CP environment to build Cell using {@link RawCellBuilder} */ @Deprecated public static Cell createCell(Cell cell, byte[] value, byte[] tags) { - if (cell instanceof ByteBufferCell) { - return new PrivateCellUtil.ValueAndTagRewriteByteBufferCell((ByteBufferCell) cell, value, - tags); - } - return new PrivateCellUtil.ValueAndTagRewriteCell(cell, value, tags); + return PrivateCellUtil.createCell(cell, tags); } /** diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCell.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCell.java index d491326..a0e4c30 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCell.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCell.java @@ -128,4 +128,50 @@ public interface ExtendedCell extends RawCell, HeapSize, Cloneable { * @param ts buffer containing the timestamp value */ void setTimestamp(byte[] ts) throws IOException; + + /** + * A region-specific unique monotonically increasing sequence ID given to each Cell. It always + * exists for cells in the memstore but is not retained forever. It will be kept for + * {@link HConstants#KEEP_SEQID_PERIOD} days, but generally becomes irrelevant after the cell's + * row is no longer involved in any operations that require strict consistency. + * @return seqId (always > 0 if exists), or 0 if it no longer exists + */ + long getSequenceId(); + + /** + * Contiguous raw bytes representing tags that may start at any index in the containing array. + * @return the tags byte array + */ + byte[] getTagsArray(); + + /** + * @return the first offset where the tags start in the Cell + */ + int getTagsOffset(); + + /** + * HBase internally uses 2 bytes to store tags length in Cell. As the tags length is always a + * non-negative number, to make good use of the sign bit, the max of tags length is defined 2 * + * Short.MAX_VALUE + 1 = 65535. As a result, the return type is int, because a short is not + * capable of handling that. Please note that even if the return type is int, the max tags length + * is far less than Integer.MAX_VALUE. + * @return the total length of the tags in the Cell. + */ + int getTagsLength(); + + /** + * {@inheritDoc} + *

+ * Note : This does not expose the internal types of Cells like {@link KeyValue.Type#Maximum} and + * {@link KeyValue.Type#Minimum} + */ + @Override + default DataType getType() { + return PrivateCellUtil.toDataType(getTypeByte()); + } + + /** + * @return The byte representation of the KeyValue.TYPE of this cell: one of Put, Delete, etc + */ + byte getTypeByte(); } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilder.java index 57fa44e..519b55e 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilder.java @@ -26,7 +26,7 @@ import org.apache.yetus.audience.InterfaceAudience; * Use {@link ExtendedCellBuilderFactory} to get ExtendedCellBuilder instance. * TODO: ditto for ByteBufferCell? */ -@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) +@InterfaceAudience.Private public interface ExtendedCellBuilder extends CellBuilder { @Override ExtendedCellBuilder setRow(final byte[] row); @@ -47,7 +47,7 @@ public interface ExtendedCellBuilder extends CellBuilder { ExtendedCellBuilder setTimestamp(final long timestamp); @Override - ExtendedCellBuilder setType(final DataType type); + ExtendedCellBuilder setType(final Cell.DataType type); ExtendedCellBuilder setType(final byte type); @@ -62,9 +62,7 @@ public interface ExtendedCellBuilder extends CellBuilder { @Override ExtendedCellBuilder clear(); - // TODO : While creating RawCellBuilder allow 'Tag' to be passed instead of byte[] ExtendedCellBuilder setTags(final byte[] tags); - // TODO : While creating RawCellBuilder allow 'Tag' to be passed instead of byte[] ExtendedCellBuilder setTags(final byte[] tags, int tagsOffset, int tagsLength); /** diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderFactory.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderFactory.java index 38778fb..0fa5c2c 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderFactory.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderFactory.java @@ -24,25 +24,19 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public final class ExtendedCellBuilderFactory { - public static ExtendedCellBuilder create(CellBuilderType type) { - return create(type, true); - } - /** * Allows creating a cell with the given CellBuilderType. * @param type the type of CellBuilder(DEEP_COPY or SHALLOW_COPY). - * @param allowSeqIdUpdate if seqId can be updated. CPs are not allowed to update - * the seqId * @return the cell that is created */ - public static ExtendedCellBuilder create(CellBuilderType type, boolean allowSeqIdUpdate) { + public static ExtendedCellBuilder create(CellBuilderType type) { switch (type) { case SHALLOW_COPY: // CPs are not allowed to update seqID and they always use DEEP_COPY. So we have not // passing 'allowSeqIdUpdate' to IndividualBytesFieldCellBuilder return new IndividualBytesFieldCellBuilder(); case DEEP_COPY: - return new KeyValueBuilder(allowSeqIdUpdate); + return new KeyValueBuilder(); default: throw new UnsupportedOperationException("The type:" + type + " is unsupported"); } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderImpl.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderImpl.java index 4dfb399..c5a94b1 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderImpl.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/ExtendedCellBuilderImpl.java @@ -17,8 +17,8 @@ */ package org.apache.hadoop.hbase; -import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.util.ArrayUtils; +import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder { @@ -40,12 +40,6 @@ public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder { protected byte[] tags = null; protected int tagsOffset = 0; protected int tagsLength = 0; - // Will go away once we do with RawCellBuilder - protected boolean allowSeqIdUpdate = false; - - public ExtendedCellBuilderImpl(boolean allowSeqIdUpdate) { - this.allowSeqIdUpdate = allowSeqIdUpdate; - } @Override public ExtendedCellBuilder setRow(final byte[] row) { @@ -93,8 +87,8 @@ public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder { } @Override - public ExtendedCellBuilder setType(final DataType type) { - this.type = toKeyValueType(type); + public ExtendedCellBuilder setType(final Cell.DataType type) { + this.type = PrivateCellUtil.toKeyValueType(type); return this; } @@ -132,11 +126,8 @@ public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder { @Override public ExtendedCellBuilder setSequenceId(final long seqId) { - if (allowSeqIdUpdate) { - this.seqId = seqId; - return this; - } - throw new UnsupportedOperationException("SeqId cannot be set on this cell"); + this.seqId = seqId; + return this; } private void checkBeforeBuild() { @@ -175,15 +166,4 @@ public abstract class ExtendedCellBuilderImpl implements ExtendedCellBuilder { tagsLength = 0; 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); - } - } } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCell.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCell.java index 4049e3d..57403cb 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCell.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCell.java @@ -18,6 +18,9 @@ package org.apache.hadoop.hbase; +import java.util.List; +import java.util.Optional; + import org.apache.hadoop.hbase.util.ArrayUtils; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.ClassSize; @@ -297,4 +300,14 @@ public class IndividualBytesFieldCell implements ExtendedCell { public String toString() { return CellUtil.toString(this, true); } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCellBuilder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCellBuilder.java index 62febf8..8a0168e 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCellBuilder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/IndividualBytesFieldCellBuilder.java @@ -22,14 +22,6 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private class IndividualBytesFieldCellBuilder extends ExtendedCellBuilderImpl { - public IndividualBytesFieldCellBuilder() { - this(true); - } - - public IndividualBytesFieldCellBuilder(boolean allowSeqIdUpdate) { - super(allowSeqIdUpdate); - } - @Override public ExtendedCell innerBuild() { return new IndividualBytesFieldCell(row, rOffset, rLength, diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java index 727eede..cf8f783 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValue.java @@ -31,6 +31,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -1521,18 +1522,6 @@ public class KeyValue implements ExtendedCell { } /** - * Returns any tags embedded in the KeyValue. Used in testcases. - * @return The tags - */ - public List getTags() { - int tagsLength = getTagsLength(); - if (tagsLength == 0) { - return EMPTY_ARRAY_LIST; - } - return TagUtil.asList(getTagsArray(), getTagsOffset(), tagsLength); - } - - /** * @return the backing array of the entire KeyValue (all KeyValue fields are in a single array) */ @Override @@ -2563,4 +2552,14 @@ public class KeyValue implements ExtendedCell { kv.setSequenceId(this.getSequenceId()); return kv; } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueBuilder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueBuilder.java index 4f01992..9480b71 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueBuilder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/KeyValueBuilder.java @@ -22,14 +22,6 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private class KeyValueBuilder extends ExtendedCellBuilderImpl { - KeyValueBuilder() { - this(true); - } - - KeyValueBuilder(boolean allowSeqIdUpdate) { - super(allowSeqIdUpdate); - } - @Override protected ExtendedCell innerBuild() { KeyValue kv = new KeyValue(row, rOffset, rLength, diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java index 79b8b31..92c043c 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java @@ -20,7 +20,6 @@ package org.apache.hadoop.hbase; import static org.apache.hadoop.hbase.HConstants.EMPTY_BYTE_ARRAY; import static org.apache.hadoop.hbase.Tag.TAG_LENGTH_SIZE; -import com.google.common.annotations.VisibleForTesting; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; @@ -31,6 +30,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Optional; + import org.apache.hadoop.hbase.KeyValue.Type; import org.apache.hadoop.hbase.filter.ByteArrayComparable; import org.apache.hadoop.hbase.io.HeapSize; @@ -43,6 +43,8 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.ClassSize; import org.apache.yetus.audience.InterfaceAudience; +import com.google.common.annotations.VisibleForTesting; + /** * Utility methods helpful slinging {@link Cell} instances. It has more powerful and * rich set of APIs than those in {@link CellUtil} for internal usage. @@ -107,7 +109,7 @@ public final class PrivateCellUtil { * @return A new cell which is having the extra tags also added to it. */ public static Cell createCell(Cell cell, List tags) { - return createCell(cell, Tag.fromList(tags)); + return createCell(cell, TagUtil.fromList(tags)); } /** @@ -311,6 +313,16 @@ public final class PrivateCellUtil { Cell clonedBaseCell = ((ExtendedCell) this.cell).deepClone(); return new TagRewriteCell(clonedBaseCell, this.tags); } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } static class TagRewriteByteBufferCell extends ByteBufferCell implements ExtendedCell { @@ -544,6 +556,16 @@ public final class PrivateCellUtil { public int getTagsPosition() { return 0; } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } static class ValueAndTagRewriteCell extends TagRewriteCell { @@ -910,6 +932,35 @@ public final class PrivateCellUtil { return Optional.ofNullable(null); } + public static Optional getTag(ByteBufferCell cell, byte type) { + int length = cell.getTagsLength(); + int offset = ((ByteBufferCell) cell).getTagsPosition(); + int pos = offset; + int tagLen; + while (pos < offset + length) { + ByteBuffer tagsBuffer = ((ByteBufferCell) cell).getTagsByteBuffer(); + tagLen = ByteBufferUtils.readAsInt(tagsBuffer, pos, TAG_LENGTH_SIZE); + if (ByteBufferUtils.toByte(tagsBuffer, pos + TAG_LENGTH_SIZE) == type) { + return Optional.ofNullable(new ByteBufferTag(tagsBuffer, pos, tagLen + TAG_LENGTH_SIZE)); + } + pos += TAG_LENGTH_SIZE + tagLen; + } + return Optional.ofNullable(null); + } + + /** + * @param cell The Cell + * @return Tags in the given Cell as a List + */ + public static List getTags(ByteBufferCell cell) { + List tags = new ArrayList<>(); + Iterator tagsItr = tagsIterator(cell); + while (tagsItr.hasNext()) { + tags.add(tagsItr.next()); + } + return tags; + } + /** * Util method to iterate through the tags in the given cell. * @param cell The Cell over which tags iterator is needed. @@ -928,7 +979,22 @@ public final class PrivateCellUtil { return CellUtil.tagsIterator(cell.getTagsArray(), cell.getTagsOffset(), cell.getTagsLength()); } - private static Iterator tagsIterator(final ByteBuffer tags, final int offset, + /** + * Util method to iterate through the tags in the given cell. + * @param cell The Cell over which tags iterator is needed. + * @return iterator for the tags + */ + private static Iterator tagsIterator(final ByteBufferCell cell) { + final int tagsLength = cell.getTagsLength(); + // Save an object allocation where we can + if (tagsLength == 0) { + return TagUtil.EMPTY_TAGS_ITR; + } + return tagsIterator(((ByteBufferCell) cell).getTagsByteBuffer(), + ((ByteBufferCell) cell).getTagsPosition(), tagsLength); + } + + public static Iterator tagsIterator(final ByteBuffer tags, final int offset, final int length) { return new Iterator() { private int pos = offset; @@ -1231,6 +1297,41 @@ public final class PrivateCellUtil { cell.getQualifierLength()); } + public static Cell.DataType toDataType(byte type) { + Type codeToType = KeyValue.Type.codeToType(type); + switch (codeToType) { + case Put: + return Cell.DataType.Put; + case Delete: + return Cell.DataType.Delete; + case DeleteColumn: + return Cell.DataType.DeleteColumn; + case DeleteFamily: + return Cell.DataType.DeleteFamily; + case DeleteFamilyVersion: + return Cell.DataType.DeleteFamilyVersion; + default: + throw new UnsupportedOperationException("Invalid type of cell "+type); + } + } + + public static KeyValue.Type toKeyValueType(Cell.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); + } + } + /** * Compare cell's value against given comparator * @param cell @@ -1345,6 +1446,16 @@ public final class PrivateCellUtil { public int getTagsLength() { return 0; } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } /** @@ -1498,6 +1609,16 @@ public final class PrivateCellUtil { public int getValuePosition() { return 0; } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } private static class FirstOnRowCell extends EmptyCell { @@ -1547,6 +1668,11 @@ public final class PrivateCellUtil { public byte getTypeByte() { return Type.Maximum.getCode(); } + + @Override + public DataType getType() { + throw new UnsupportedOperationException(); + } } private static class FirstOnRowByteBufferCell extends EmptyByteBufferCell { @@ -1597,6 +1723,11 @@ public final class PrivateCellUtil { public byte getTypeByte() { return Type.Maximum.getCode(); } + + @Override + public DataType getType() { + throw new UnsupportedOperationException(); + } } private static class LastOnRowByteBufferCell extends EmptyByteBufferCell { @@ -1647,6 +1778,11 @@ public final class PrivateCellUtil { public byte getTypeByte() { return Type.Minimum.getCode(); } + + @Override + public DataType getType() { + throw new UnsupportedOperationException(); + } } private static class FirstOnRowColByteBufferCell extends FirstOnRowByteBufferCell { @@ -1875,6 +2011,11 @@ public final class PrivateCellUtil { public byte getTypeByte() { return Type.Minimum.getCode(); } + + @Override + public DataType getType() { + throw new UnsupportedOperationException(); + } } private static class LastOnRowColCell extends LastOnRowCell { @@ -2060,6 +2201,11 @@ public final class PrivateCellUtil { public byte getTypeByte() { return Type.DeleteFamily.getCode(); } + + @Override + public DataType getType() { + return DataType.DeleteFamily; + } } /** @@ -2890,5 +3036,4 @@ public final class PrivateCellUtil { public static Cell createFirstDeleteFamilyCellOnRow(final byte[] row, final byte[] fam) { return new FirstOnRowDeleteFamilyCell(row, fam); } - } diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCell.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCell.java index 9e25a9a..4cda7d5 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCell.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCell.java @@ -41,19 +41,14 @@ public interface RawCell extends Cell { * Creates a list of tags in the current cell * @return a list of tags */ - default List getTags() { - return PrivateCellUtil.getTags(this); - } + List getTags(); /** * Returns the specific tag of the given type * @param type the type of the tag * @return the specific tag if available or null */ - // TODO : Move to individual cell impl - default Optional getTag(byte type) { - return PrivateCellUtil.getTag(this, type); - } + Optional getTag(byte type); /** * Check the length of tags. If it is invalid, throw IllegalArgumentException diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilder.java new file mode 100644 index 0000000..22bb358 --- /dev/null +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilder.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase; + +import java.util.List; + +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Allows creating a cell with {@link Tag} + */ +@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) +public interface RawCellBuilder extends CellBuilder { + @Override + RawCellBuilder setRow(final byte[] row); + @Override + RawCellBuilder setRow(final byte[] row, final int rOffset, final int rLength); + + @Override + RawCellBuilder setFamily(final byte[] family); + @Override + RawCellBuilder setFamily(final byte[] family, final int fOffset, final int fLength); + + @Override + RawCellBuilder setQualifier(final byte[] qualifier); + @Override + RawCellBuilder setQualifier(final byte[] qualifier, final int qOffset, final int qLength); + + @Override + RawCellBuilder setTimestamp(final long timestamp); + + @Override + RawCellBuilder setType(final Cell.DataType type); + + @Override + RawCellBuilder setValue(final byte[] value); + @Override + RawCellBuilder setValue(final byte[] value, final int vOffset, final int vLength); + + RawCellBuilder setTags(final List tags); + + @Override + RawCell build(); + + @Override + RawCellBuilder clear(); +} diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilderFactory.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilderFactory.java new file mode 100644 index 0000000..1d2b2b9 --- /dev/null +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilderFactory.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.hbase; + +import org.apache.yetus.audience.InterfaceAudience; + + +@InterfaceAudience.Private +public final class RawCellBuilderFactory { + + /** + * @return the cell that is created + */ + public static RawCellBuilder create() { + return new RawKeyValueBuilder(); + } + + private RawCellBuilderFactory() { + } +} diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilderImpl.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilderImpl.java new file mode 100644 index 0000000..7050d3d --- /dev/null +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawCellBuilderImpl.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase; + +import java.util.List; + +import org.apache.hadoop.hbase.util.ArrayUtils; +import org.apache.yetus.audience.InterfaceAudience; + +@InterfaceAudience.Private +public abstract class RawCellBuilderImpl implements RawCellBuilder { + protected byte[] row = null; + protected int rOffset = 0; + protected int rLength = 0; + protected byte[] family = null; + protected int fOffset = 0; + protected int fLength = 0; + protected byte[] qualifier = null; + protected int qOffset = 0; + protected int qLength = 0; + protected long timestamp = HConstants.LATEST_TIMESTAMP; + protected KeyValue.Type type = null; + protected byte[] value = null; + protected int vOffset = 0; + protected int vLength = 0; + protected List tags = null; + @Override + public RawCellBuilder setRow(final byte[] row) { + return setRow(row, 0, ArrayUtils.length(row)); + } + + @Override + public RawCellBuilder setRow(final byte[] row, int rOffset, int rLength) { + this.row = row; + this.rOffset = rOffset; + this.rLength = rLength; + return this; + } + + @Override + public RawCellBuilder setFamily(final byte[] family) { + return setFamily(family, 0, ArrayUtils.length(family)); + } + + @Override + public RawCellBuilder setFamily(final byte[] family, int fOffset, int fLength) { + this.family = family; + this.fOffset = fOffset; + this.fLength = fLength; + return this; + } + + @Override + public RawCellBuilder setQualifier(final byte[] qualifier) { + return setQualifier(qualifier, 0, ArrayUtils.length(qualifier)); + } + + @Override + public RawCellBuilder setQualifier(final byte[] qualifier, int qOffset, int qLength) { + this.qualifier = qualifier; + this.qOffset = qOffset; + this.qLength = qLength; + return this; + } + + @Override + public RawCellBuilder setTimestamp(final long timestamp) { + this.timestamp = timestamp; + return this; + } + + @Override + public RawCellBuilder setType(final Cell.DataType type) { + this.type = PrivateCellUtil.toKeyValueType(type); + return this; + } + + @Override + public RawCellBuilder setValue(final byte[] value) { + return setValue(value, 0, ArrayUtils.length(value)); + } + + @Override + public RawCellBuilder setValue(final byte[] value, int vOffset, int vLength) { + this.value = value; + this.vOffset = vOffset; + this.vLength = vLength; + return this; + } + + @Override + public RawCellBuilder setTags(List tags) { + this.tags = tags; + return this; + } + + private void checkBeforeBuild() { + if (type == null) { + throw new IllegalArgumentException("The type can't be NULL"); + } + } + + protected abstract RawCell innerBuild(); + + @Override + public RawCell build() { + checkBeforeBuild(); + return innerBuild(); + } + + @Override + public RawCellBuilder clear() { + row = null; + rOffset = 0; + rLength = 0; + family = null; + fOffset = 0; + fLength = 0; + qualifier = null; + qOffset = 0; + qLength = 0; + timestamp = HConstants.LATEST_TIMESTAMP; + type = null; + value = null; + vOffset = 0; + vLength = 0; + tags = null; + return this; + } +} diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/RawKeyValueBuilder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawKeyValueBuilder.java new file mode 100644 index 0000000..aa835b4 --- /dev/null +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/RawKeyValueBuilder.java @@ -0,0 +1,35 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase; + +import org.apache.yetus.audience.InterfaceAudience; + +@InterfaceAudience.Private +class RawKeyValueBuilder extends RawCellBuilderImpl { + + @Override + protected RawCell innerBuild() { + KeyValue kv = new KeyValue(row, rOffset, rLength, + family, fOffset, fLength, + qualifier, qOffset, qLength, + timestamp, type, + value, vOffset, vLength, + tags); + return kv; + } +} diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/Tag.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/Tag.java index 8709814..6f9bfdc 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/Tag.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/Tag.java @@ -20,7 +20,6 @@ package org.apache.hadoop.hbase; import java.nio.ByteBuffer; -import java.util.List; import org.apache.hadoop.hbase.util.ByteBufferUtils; import org.apache.hadoop.hbase.util.Bytes; @@ -153,38 +152,6 @@ public interface Tag { } /** - * Write a list of tags into a byte array - * @param tags The list of tags - * @return the serialized tag data as bytes - */ - // TODO : Remove this when we move to RawCellBuilder - public static byte[] fromList(List tags) { - if (tags == null || tags.isEmpty()) { - return HConstants.EMPTY_BYTE_ARRAY; - } - int length = 0; - for (Tag tag : tags) { - length += tag.getValueLength() + Tag.INFRASTRUCTURE_SIZE; - } - byte[] b = new byte[length]; - int pos = 0; - int tlen; - for (Tag tag : tags) { - tlen = tag.getValueLength(); - pos = Bytes.putAsShort(b, pos, tlen + Tag.TYPE_LENGTH_SIZE); - pos = Bytes.putByte(b, pos, tag.getType()); - if (tag.hasArray()) { - pos = Bytes.putBytes(b, pos, tag.getValueArray(), tag.getValueOffset(), tlen); - } else { - ByteBufferUtils.copyFromBufferToArray(b, tag.getValueByteBuffer(), tag.getValueOffset(), - pos, tlen); - pos += tlen; - } - } - return b; - } - - /** * Converts the value bytes of the given tag into a long value * @param tag The Tag * @return value as long diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/TagUtil.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/TagUtil.java index 6ad66ba..a3c1716 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/TagUtil.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/TagUtil.java @@ -137,6 +137,37 @@ public final class TagUtil { } /** + * Write a list of tags into a byte array + * @param tags The list of tags + * @return the serialized tag data as bytes + */ + public static byte[] fromList(List tags) { + if (tags == null || tags.isEmpty()) { + return HConstants.EMPTY_BYTE_ARRAY; + } + int length = 0; + for (Tag tag : tags) { + length += tag.getValueLength() + Tag.INFRASTRUCTURE_SIZE; + } + byte[] b = new byte[length]; + int pos = 0; + int tlen; + for (Tag tag : tags) { + tlen = tag.getValueLength(); + pos = Bytes.putAsShort(b, pos, tlen + Tag.TYPE_LENGTH_SIZE); + pos = Bytes.putByte(b, pos, tag.getType()); + if (tag.hasArray()) { + pos = Bytes.putBytes(b, pos, tag.getValueArray(), tag.getValueOffset(), tlen); + } else { + ByteBufferUtils.copyFromBufferToArray(b, tag.getValueByteBuffer(), tag.getValueOffset(), + pos, tlen); + pos += tlen; + } + } + return b; + } + + /** * Iterator returned when no Tags. Used by CellUtil too. */ static final Iterator EMPTY_TAGS_ITR = new Iterator() { diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java index 67a337d..db1f7af 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/encoding/BufferedDataBlockEncoder.java @@ -21,6 +21,9 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.util.List; +import java.util.Optional; + import org.apache.hadoop.hbase.ByteBufferCell; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellComparator; @@ -31,6 +34,7 @@ import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue.Type; import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.hadoop.hbase.PrivateCellUtil; +import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.io.TagCompressionContext; import org.apache.hadoop.hbase.io.util.LRUDictionary; import org.apache.hadoop.hbase.io.util.StreamUtils; @@ -474,6 +478,16 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder { // This is not used in actual flow. Throwing UnsupportedOperationException throw new UnsupportedOperationException(); } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } } protected static class OffheapDecodedCell extends ByteBufferCell implements ExtendedCell { @@ -719,6 +733,17 @@ abstract class BufferedDataBlockEncoder extends AbstractDataBlockEncoder { // This is not used in actual flow. Throwing UnsupportedOperationException throw new UnsupportedOperationException(); } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(this, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(this); + } + } protected abstract static class BufferedEncodedSeeker diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellBuilder.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellBuilder.java index b875414..a92ce99 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellBuilder.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellBuilder.java @@ -41,7 +41,7 @@ public class TestCellBuilder { .setRow(row) .setFamily(family) .setQualifier(qualifier) - .setType(CellBuilder.DataType.Put) + .setType(Cell.DataType.Put) .setValue(value) .build(); row[0] = NEW_DATA; @@ -64,7 +64,7 @@ public class TestCellBuilder { .setRow(row) .setFamily(family) .setQualifier(qualifier) - .setType(CellBuilder.DataType.Put) + .setType(Cell.DataType.Put) .setValue(value) .build(); row[0] = NEW_DATA; diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java index 397476f..bf7ae5f 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestCellUtil.java @@ -197,6 +197,11 @@ public class TestCellUtil { // TODO Auto-generated method stub return 0; } + + @Override + public DataType getType() { + return PrivateCellUtil.toDataType(getTypeByte()); + } }; /** @@ -603,5 +608,10 @@ public class TestCellUtil { public int getTagsLength() { return this.kv.getTagsLength(); } + + @Override + public DataType getType() { + return PrivateCellUtil.toDataType(getTypeByte()); + } } } diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java index 45adc98..93d5479 100644 --- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java +++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestKeyValue.java @@ -738,5 +738,10 @@ public class TestKeyValue extends TestCase { public byte[] getTagsArray() { return this.kv.getTagsArray(); } + + @Override + public DataType getType() { + return PrivateCellUtil.toDataType(getTypeByte()); + } } } diff --git a/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/ValueRewritingObserver.java b/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/ValueRewritingObserver.java index 863ea89..cf7796b 100644 --- a/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/ValueRewritingObserver.java +++ b/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/ValueRewritingObserver.java @@ -22,7 +22,6 @@ import java.util.Optional; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellBuilder; -import org.apache.hadoop.hbase.CellBuilder.DataType; import org.apache.hadoop.hbase.CellBuilderFactory; import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellUtil; @@ -89,7 +88,7 @@ public class ValueRewritingObserver implements RegionObserver, RegionCoprocessor cellBuilder.setFamily(CellUtil.cloneFamily(c)); cellBuilder.setQualifier(CellUtil.cloneQualifier(c)); cellBuilder.setTimestamp(c.getTimestamp()); - cellBuilder.setType(DataType.Put); + cellBuilder.setType(Cell.DataType.Put); // Make sure each cell gets a unique value byte[] clonedValue = new byte[replacedValue.length]; System.arraycopy(replacedValue, 0, clonedValue, 0, replacedValue.length); diff --git a/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/WriteHeavyIncrementObserver.java b/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/WriteHeavyIncrementObserver.java index 55d9ac3..e59ccd6 100644 --- a/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/WriteHeavyIncrementObserver.java +++ b/hbase-examples/src/main/java/org/apache/hadoop/hbase/coprocessor/example/WriteHeavyIncrementObserver.java @@ -80,7 +80,7 @@ public class WriteHeavyIncrementObserver implements RegionCoprocessor, RegionObs private Cell createCell(byte[] row, byte[] family, byte[] qualifier, long ts, long value) { return CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(row) - .setType(CellBuilder.DataType.Put).setFamily(family).setQualifier(qualifier) + .setType(Cell.DataType.Put).setFamily(family).setQualifier(qualifier) .setTimestamp(ts).setValue(Bytes.toBytes(value)).build(); } @@ -250,7 +250,7 @@ public class WriteHeavyIncrementObserver implements RegionCoprocessor, RegionObs .setQualifier(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()) .setValue(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()) - .setType(CellBuilder.DataType.Put).setTimestamp(ts).build()); + .setType(Cell.DataType.Put).setTimestamp(ts).build()); } } c.getEnvironment().getRegion().put(put); diff --git a/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java b/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java index 7f94f93..e7de604 100644 --- a/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java +++ b/hbase-examples/src/test/java/org/apache/hadoop/hbase/types/TestPBCell.java @@ -54,6 +54,7 @@ public class TestPBCell { pbr.setPosition(0); decoded = CODEC.decode(pbr); assertEquals(encodedLength, pbr.getPosition()); - assertTrue(CellUtil.equals(cell, ProtobufUtil.toCell(ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), decoded))); + assertTrue(CellUtil.equals(cell, + ProtobufUtil.toCell(ExtendedCellBuilderFactory.create(CellBuilderType.SHALLOW_COPY), decoded))); } } diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/util/MapReduceCell.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/util/MapReduceCell.java index 38ff59b..3c5d19e 100644 --- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/util/MapReduceCell.java +++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/util/MapReduceCell.java @@ -20,12 +20,15 @@ package org.apache.hadoop.hbase.util; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.util.List; +import java.util.Optional; import org.apache.hadoop.hbase.ByteBufferCell; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.ExtendedCell; import org.apache.hadoop.hbase.PrivateCellUtil; +import org.apache.hadoop.hbase.Tag; import org.apache.yetus.audience.InterfaceAudience; /** @@ -268,4 +271,14 @@ public class MapReduceCell extends ByteBufferCell implements ExtendedCell { throw new RuntimeException(e); } } + + @Override + public Optional getTag(byte type) { + return PrivateCellUtil.getTag(cell, type); + } + + @Override + public List getTags() { + return PrivateCellUtil.getTags(cell); + } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java index 3380639..84e6d25 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java @@ -24,8 +24,8 @@ import java.util.concurrent.ConcurrentMap; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CoprocessorEnvironment; -import org.apache.hadoop.hbase.ExtendedCellBuilder; import org.apache.hadoop.hbase.HBaseInterfaceAudience; +import org.apache.hadoop.hbase.RawCellBuilder; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.RegionInfo; @@ -127,7 +127,7 @@ public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment tags = new ArrayList<>(); tags.add(MobConstants.MOB_REF_TAG); - REF_DELETE_MARKER_TAG_BYTES = Tag.fromList(tags); + REF_DELETE_MARKER_TAG_BYTES = TagUtil.fromList(tags); } /** @@ -502,7 +502,7 @@ public final class MobUtils { // find the original mob files by this table name. For details please see cloning // snapshot for mob files. tags.add(tableNameTag); - return createMobRefCell(cell, fileName, Tag.fromList(tags)); + return createMobRefCell(cell, fileName, TagUtil.fromList(tags)); } public static Cell createMobRefCell(Cell cell, byte[] fileName, byte[] refCellTags) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/compactions/PartitionedMobCompactor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/compactions/PartitionedMobCompactor.java index 0cccfa3..cf661db 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/compactions/PartitionedMobCompactor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/compactions/PartitionedMobCompactor.java @@ -54,6 +54,7 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.TagType; +import org.apache.hadoop.hbase.TagUtil; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; @@ -131,7 +132,7 @@ public class PartitionedMobCompactor extends MobCompactor { tags.add(MobConstants.MOB_REF_TAG); Tag tableNameTag = new ArrayBackedTag(TagType.MOB_TABLE_NAME_TAG_TYPE, tableName.getName()); tags.add(tableNameTag); - this.refCellTags = Tag.fromList(tags); + this.refCellTags = TagUtil.fromList(tags); cryptoContext = EncryptionUtil.createEncryptionContext(copyOfConf, column); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java index 5db7383..c85cb7c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HMobStore.java @@ -34,14 +34,16 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.ArrayBackedTag; import org.apache.hadoop.hbase.Cell; -import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.DoNotRetryIOException; -import org.apache.hadoop.hbase.ExtendedCellBuilderFactory; +import org.apache.hadoop.hbase.ExtendedCell; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.PrivateCellUtil; +import org.apache.hadoop.hbase.RawCellBuilderFactory; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.TagType; +import org.apache.hadoop.hbase.TagUtil; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.filter.Filter; @@ -120,7 +122,7 @@ public class HMobStore extends HStore { Tag tableNameTag = new ArrayBackedTag(TagType.MOB_TABLE_NAME_TAG_TYPE, getTableName().getName()); tags.add(tableNameTag); - this.refCellTags = Tag.fromList(tags); + this.refCellTags = TagUtil.fromList(tags); } /** @@ -356,17 +358,18 @@ public class HMobStore extends HStore { if (result == null) { LOG.warn("The Cell result is null, assemble a new Cell with the same row,family," + "qualifier,timestamp,type and tags but with an empty value to return."); - result = ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY) + assert reference instanceof ExtendedCell; + List tags = ((ExtendedCell)reference).getTags(); + result = RawCellBuilderFactory.create() .setRow(reference.getRowArray(), reference.getRowOffset(), reference.getRowLength()) .setFamily(reference.getFamilyArray(), reference.getFamilyOffset(), reference.getFamilyLength()) .setQualifier(reference.getQualifierArray(), reference.getQualifierOffset(), reference.getQualifierLength()) .setTimestamp(reference.getTimestamp()) - .setType(reference.getTypeByte()) + .setType(PrivateCellUtil.toDataType(((ExtendedCell) reference).getTypeByte())) .setValue(HConstants.EMPTY_BYTE_ARRAY) - .setTags(reference.getTagsArray(), reference.getTagsOffset(), - reference.getTagsLength()) + .setTags(tags) .build(); } return result; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index 85c12e9..e807d4f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -7752,7 +7752,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi .setTimestamp(Math.max(currentCell.getTimestamp() + 1, now)) .setType(KeyValue.Type.Put.getCode()) .setValue(newValue, 0, newValue.length) - .setTags(Tag.fromList(tags)) + .setTags(TagUtil.fromList(tags)) .build(); } else { PrivateCellUtil.updateLatestStamp(delta, now); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java index b8356a7..7e7aa75 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionCoprocessorHost.java @@ -18,9 +18,6 @@ package org.apache.hadoop.hbase.regionserver; -import com.google.protobuf.Message; -import com.google.protobuf.Service; - import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -41,10 +38,11 @@ import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellBuilderType; import org.apache.hadoop.hbase.CompareOperator; import org.apache.hadoop.hbase.Coprocessor; -import org.apache.hadoop.hbase.ExtendedCellBuilder; import org.apache.hadoop.hbase.ExtendedCellBuilderFactory; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.RawCellBuilder; +import org.apache.hadoop.hbase.RawCellBuilderFactory; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.SharedConnection; import org.apache.hadoop.hbase.client.Append; @@ -92,6 +90,9 @@ import org.apache.hadoop.hbase.wal.WALEdit; import org.apache.hadoop.hbase.wal.WALKey; import org.apache.yetus.audience.InterfaceAudience; +import com.google.protobuf.Message; +import com.google.protobuf.Service; + /** * Implements the coprocessor environment and runtime support for coprocessors * loaded within a {@link Region}. @@ -184,10 +185,9 @@ public class RegionCoprocessorHost } @Override - public ExtendedCellBuilder getCellBuilder() { - // do not allow seqId update. + public RawCellBuilder getCellBuilder() { // We always do a DEEP_COPY only - return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY, false); + return RawCellBuilderFactory.create(); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java index c6f81c4..d6efdf3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java @@ -18,11 +18,6 @@ package org.apache.hadoop.hbase.security.visibility; -import com.google.protobuf.ByteString; -import com.google.protobuf.RpcCallback; -import com.google.protobuf.RpcController; -import com.google.protobuf.Service; - import static org.apache.hadoop.hbase.HConstants.OperationStatusCode.SANITY_CHECK_FAILURE; import static org.apache.hadoop.hbase.HConstants.OperationStatusCode.SUCCESS; import static org.apache.hadoop.hbase.security.visibility.VisibilityConstants.LABELS_TABLE_FAMILY; @@ -115,6 +110,11 @@ import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.util.StringUtils; import org.apache.yetus.audience.InterfaceAudience; +import com.google.protobuf.ByteString; +import com.google.protobuf.RpcCallback; +import com.google.protobuf.RpcController; +import com.google.protobuf.Service; + /** * Coprocessor that has both the MasterObserver and RegionObserver implemented that supports in * visibility labels diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityReplicationEndpoint.java index 038b799..14507a4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityReplicationEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityReplicationEndpoint.java @@ -28,17 +28,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hbase.ArrayBackedTag; import org.apache.hadoop.hbase.Cell; -import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.TagType; -import org.apache.hadoop.hbase.wal.WALKeyImpl; -import org.apache.yetus.audience.InterfaceAudience; -import org.apache.hadoop.hbase.wal.WALEdit; import org.apache.hadoop.hbase.replication.ReplicationEndpoint; import org.apache.hadoop.hbase.replication.ReplicationPeerConfig; import org.apache.hadoop.hbase.replication.WALEntryFilter; import org.apache.hadoop.hbase.wal.WAL.Entry; +import org.apache.hadoop.hbase.wal.WALEdit; +import org.apache.hadoop.hbase.wal.WALKeyImpl; +import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public class VisibilityReplicationEndpoint implements ReplicationEndpoint { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MockHStoreFile.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MockHStoreFile.java index 19f4dbe..863aade 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MockHStoreFile.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/MockHStoreFile.java @@ -192,7 +192,7 @@ public class MockHStoreFile extends HStoreFile { public Optional getLastKey() { if (splitPoint != null) { return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY) - .setType(CellBuilder.DataType.Put) + .setType(Cell.DataType.Put) .setRow(Arrays.copyOf(splitPoint, splitPoint.length + 1)).build()); } else { return Optional.empty(); @@ -203,7 +203,7 @@ public class MockHStoreFile extends HStoreFile { public Optional midKey() throws IOException { if (splitPoint != null) { return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY) - .setType(CellBuilder.DataType.Put).setRow(splitPoint).build()); + .setType(Cell.DataType.Put).setRow(splitPoint).build()); } else { return Optional.empty(); } @@ -213,7 +213,7 @@ public class MockHStoreFile extends HStoreFile { public Optional getFirstKey() { if (splitPoint != null) { return Optional.of(CellBuilderFactory.create(CellBuilderType.DEEP_COPY) - .setType(CellBuilder.DataType.Put).setRow(splitPoint, 0, splitPoint.length - 1) + .setType(Cell.DataType.Put).setRow(splitPoint, 0, splitPoint.length - 1) .build()); } else { return Optional.empty(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java index 39ed9df..6c67b78 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHStore.java @@ -59,7 +59,6 @@ import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; 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.CellComparator; @@ -69,9 +68,9 @@ import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; -import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.MemoryCompactionPolicy; +import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; @@ -94,6 +93,7 @@ import org.apache.hadoop.hbase.regionserver.compactions.DefaultCompactor; import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher; import org.apache.hadoop.hbase.regionserver.throttle.NoLimitThroughputController; import org.apache.hadoop.hbase.security.User; +import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.RegionServerTests; import org.apache.hadoop.hbase.util.Bytes; @@ -114,8 +114,6 @@ import org.junit.experimental.categories.Category; import org.junit.rules.TestName; import org.mockito.Mockito; -import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists; - /** * Test class for the HStore */ @@ -1049,13 +1047,13 @@ public class TestHStore { long seqId = 100; long timestamp = System.currentTimeMillis(); Cell cell0 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family) - .setQualifier(qf1).setTimestamp(timestamp).setType(CellBuilder.DataType.Put) + .setQualifier(qf1).setTimestamp(timestamp).setType(Cell.DataType.Put) .setValue(qf1).build(); PrivateCellUtil.setSequenceId(cell0, seqId); testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Collections.emptyList()); Cell cell1 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family) - .setQualifier(qf2).setTimestamp(timestamp).setType(CellBuilder.DataType.Put) + .setQualifier(qf2).setTimestamp(timestamp).setType(Cell.DataType.Put) .setValue(qf1).build(); PrivateCellUtil.setSequenceId(cell1, seqId); testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Arrays.asList(cell1)); @@ -1063,7 +1061,7 @@ public class TestHStore { seqId = 101; timestamp = System.currentTimeMillis(); Cell cell2 = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row2).setFamily(family) - .setQualifier(qf2).setTimestamp(timestamp).setType(CellBuilder.DataType.Put) + .setQualifier(qf2).setTimestamp(timestamp).setType(Cell.DataType.Put) .setValue(qf1).build(); PrivateCellUtil.setSequenceId(cell2, seqId); testNumberOfMemStoreScannersAfterFlush(Arrays.asList(cell0), Arrays.asList(cell1, cell2)); @@ -1118,7 +1116,7 @@ public class TestHStore { private Cell createCell(byte[] row, byte[] qualifier, long ts, long sequenceId, byte[] value) throws IOException { Cell c = CellBuilderFactory.create(CellBuilderType.DEEP_COPY).setRow(row).setFamily(family) - .setQualifier(qualifier).setTimestamp(ts).setType(CellBuilder.DataType.Put) + .setQualifier(qualifier).setTimestamp(ts).setType(Cell.DataType.Put) .setValue(value).build(); PrivateCellUtil.setSequenceId(c, sequenceId); return c; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java index e8d8b7e..e102cb2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestTokenAuthentication.java @@ -42,6 +42,7 @@ import org.apache.hadoop.hbase.CoordinatedStateManager; import org.apache.hadoop.hbase.ExtendedCellBuilder; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionInfo; +import org.apache.hadoop.hbase.RawCellBuilder; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.client.ClusterConnection; @@ -331,7 +332,7 @@ public class TestTokenAuthentication { } @Override - public ExtendedCellBuilder getCellBuilder() { + public RawCellBuilder getCellBuilder() { return null; } });