HBASE-18515 Introduce Delete.add as a replacement for Delete#addDeleteMarker
Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
parent
5915d73a70
commit
a7014ce46c
|
@ -151,15 +151,26 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Advanced use only.
|
||||
* Advanced use only. Add an existing delete marker to this Delete object.
|
||||
* @param kv An existing KeyValue of type "delete".
|
||||
* @return this for invocation chaining
|
||||
* @throws IOException
|
||||
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. Use {@link #add(Cell)}
|
||||
* instead
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Deprecated
|
||||
public Delete addDeleteMarker(Cell kv) throws IOException {
|
||||
return this.add(kv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an existing delete marker to this Delete object.
|
||||
* @param kv An existing KeyValue of type "delete".
|
||||
* @return this for invocation chaining
|
||||
* @throws IOException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Delete addDeleteMarker(Cell kv) throws IOException {
|
||||
// TODO: Deprecate and rename 'add' so it matches how we add KVs to Puts.
|
||||
public Delete add(Cell kv) throws IOException {
|
||||
if (!CellUtil.isDelete(kv)) {
|
||||
throw new IOException("The recently added KeyValue is not of type "
|
||||
+ "delete. Rowkey: " + Bytes.toStringBinary(this.row));
|
||||
|
@ -178,7 +189,6 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete all versions of all columns of the specified family.
|
||||
* <p>
|
||||
|
|
|
@ -579,7 +579,7 @@ public final class ProtobufUtil {
|
|||
delete =
|
||||
new Delete(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), timestamp);
|
||||
}
|
||||
delete.addDeleteMarker(cell);
|
||||
delete.add(cell);
|
||||
}
|
||||
} else {
|
||||
if (delete == null) {
|
||||
|
|
|
@ -730,7 +730,7 @@ public final class ProtobufUtil {
|
|||
delete =
|
||||
new Delete(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), timestamp);
|
||||
}
|
||||
delete.addDeleteMarker(cell);
|
||||
delete.add(cell);
|
||||
}
|
||||
} else {
|
||||
if (delete == null) {
|
||||
|
|
|
@ -548,7 +548,7 @@ public class TestRowProcessorEndpoint {
|
|||
KeyValue kvDelete =
|
||||
new KeyValue(rows[i], CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv),
|
||||
kv.getTimestamp(), KeyValue.Type.Delete);
|
||||
d.addDeleteMarker(kvDelete);
|
||||
d.add(kvDelete);
|
||||
Put p = new Put(rows[1 - i]);
|
||||
KeyValue kvAdd =
|
||||
new KeyValue(rows[1 - i], CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv),
|
||||
|
|
|
@ -354,7 +354,7 @@ public class Import extends Configured implements Tool {
|
|||
*/
|
||||
if (CellUtil.isDeleteFamily(kv)) {
|
||||
Delete deleteFamily = new Delete(key.get());
|
||||
deleteFamily.addDeleteMarker(kv);
|
||||
deleteFamily.add(kv);
|
||||
if (durability != null) {
|
||||
deleteFamily.setDurability(durability);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ public class Import extends Configured implements Tool {
|
|||
if (delete == null) {
|
||||
delete = new Delete(key.get());
|
||||
}
|
||||
delete.addDeleteMarker(kv);
|
||||
delete.add(kv);
|
||||
} else {
|
||||
if (put == null) {
|
||||
put = new Put(key.get());
|
||||
|
|
|
@ -182,7 +182,7 @@ public class WALPlayer extends Configured implements Tool {
|
|||
}
|
||||
}
|
||||
if (CellUtil.isDelete(cell)) {
|
||||
del.addDeleteMarker(cell);
|
||||
del.add(cell);
|
||||
} else {
|
||||
put.add(cell);
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class ReplicationSink {
|
|||
addToHashMultiMap(rowMap, table, clusterIds, m);
|
||||
}
|
||||
if (CellUtil.isDelete(cell)) {
|
||||
((Delete) m).addDeleteMarker(cell);
|
||||
((Delete) m).add(cell);
|
||||
} else {
|
||||
((Put) m).add(cell);
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ public class VisibilityController implements MasterObserver, RegionObserver,
|
|||
p.add(cell);
|
||||
} else if (m instanceof Delete) {
|
||||
Delete d = (Delete) m;
|
||||
d.addDeleteMarker(cell);
|
||||
d.add(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2376,7 +2376,7 @@ public class WALSplitter {
|
|||
}
|
||||
}
|
||||
if (CellUtil.isDelete(cell)) {
|
||||
((Delete) m).addDeleteMarker(cell);
|
||||
((Delete) m).add(cell);
|
||||
} else {
|
||||
((Put) m).add(cell);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue