HBASE-25425 Some notes on RawCell

This commit is contained in:
stack 2020-12-20 20:25:09 -08:00
parent 9229a8b986
commit eedd976c6e
2 changed files with 5 additions and 11 deletions

View File

@ -40,7 +40,6 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.IndividualBytesFieldCell; import org.apache.hadoop.hbase.IndividualBytesFieldCell;
import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.PrivateCellUtil;
import org.apache.hadoop.hbase.RawCell;
import org.apache.hadoop.hbase.Tag; import org.apache.hadoop.hbase.Tag;
import org.apache.hadoop.hbase.exceptions.DeserializationException; import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.io.HeapSize; import org.apache.hadoop.hbase.io.HeapSize;
@ -932,25 +931,16 @@ public abstract class Mutation extends OperationWithAttributes implements Row, C
@Override @Override
public Optional<Tag> getTag(byte type) { public Optional<Tag> getTag(byte type) {
if (cell instanceof RawCell) {
return ((RawCell) cell).getTag(type);
}
return PrivateCellUtil.getTag(cell, type); return PrivateCellUtil.getTag(cell, type);
} }
@Override @Override
public Iterator<Tag> getTags() { public Iterator<Tag> getTags() {
if (cell instanceof RawCell) {
return ((RawCell) cell).getTags();
}
return PrivateCellUtil.tagsIterator(cell); return PrivateCellUtil.tagsIterator(cell);
} }
@Override @Override
public byte[] cloneTags() { public byte[] cloneTags() {
if (cell instanceof RawCell) {
return ((RawCell) cell).cloneTags();
}
return PrivateCellUtil.cloneTags(cell); return PrivateCellUtil.cloneTags(cell);
} }

View File

@ -24,8 +24,12 @@ import java.util.Optional;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
/** /**
* An extended version of cell that gives more power to CPs * An extended version of Cell that allows CPs manipulate Tags.
*/ */
// Added by HBASE-19092 to expose Tags to CPs (history server) w/o exposing ExtendedCell.
// Why is this in hbase-common and not in hbase-server where it is used?
// RawCell is an odd name for a class that is only for CPs that want to manipulate Tags on
// server-side only w/o exposing ExtendedCell -- super rare, super exotic.
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC) @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
public interface RawCell extends Cell { public interface RawCell extends Cell {
static final int MAX_TAGS_LENGTH = (2 * Short.MAX_VALUE) + 1; static final int MAX_TAGS_LENGTH = (2 * Short.MAX_VALUE) + 1;