HBASE-9493 Rename CellUtil#get*Array to CellUtil#clone*
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1521676 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3dbfa9f20d
commit
3e25e1b7f5
|
@ -161,7 +161,7 @@ public class Delete extends Mutation implements Comparable<Row> {
|
|||
throw new WrongRowIOException("The row in " + kv.toString() +
|
||||
" doesn't match the original one " + Bytes.toStringBinary(this.row));
|
||||
}
|
||||
byte [] family = CellUtil.getFamilyArray(kv);
|
||||
byte [] family = CellUtil.cloneFamily(kv);
|
||||
List<Cell> list = familyMap.get(family);
|
||||
if (list == null) {
|
||||
list = new ArrayList<Cell>();
|
||||
|
|
|
@ -128,7 +128,7 @@ public class Put extends Mutation implements HeapSize, Comparable<Row> {
|
|||
List<Cell> list = getCellList(family);
|
||||
KeyValue kv = createPutKeyValue(family, qualifier, ts, value);
|
||||
list.add(kv);
|
||||
familyMap.put(CellUtil.getFamilyArray(kv), list);
|
||||
familyMap.put(CellUtil.cloneFamily(kv), list);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class Put extends Mutation implements HeapSize, Comparable<Row> {
|
|||
* @throws java.io.IOException e
|
||||
*/
|
||||
public Put add(Cell kv) throws IOException{
|
||||
byte [] family = CellUtil.getFamilyArray(kv);
|
||||
byte [] family = CellUtil.cloneFamily(kv);
|
||||
List<Cell> list = getCellList(family);
|
||||
//Checking that the row of the kv is the same as the put
|
||||
int res = Bytes.compareTo(this.row, 0, row.length,
|
||||
|
|
|
@ -122,7 +122,7 @@ public class Result implements CellScannable {
|
|||
*/
|
||||
public byte [] getRow() {
|
||||
if (this.row == null) {
|
||||
this.row = this.cells == null || this.cells.length == 0? null: CellUtil.getRowArray(this.cells[0]);
|
||||
this.row = this.cells == null || this.cells.length == 0? null: CellUtil.cloneRow(this.cells[0]);
|
||||
}
|
||||
return this.row;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ public class Result implements CellScannable {
|
|||
final byte [] family,
|
||||
final byte [] qualifier) {
|
||||
Cell searchTerm =
|
||||
KeyValue.createFirstOnRow(CellUtil.getRowArray(kvs[0]),
|
||||
KeyValue.createFirstOnRow(CellUtil.cloneRow(kvs[0]),
|
||||
family, qualifier);
|
||||
|
||||
// pos === ( -(insertion point) - 1)
|
||||
|
@ -367,7 +367,7 @@ public class Result implements CellScannable {
|
|||
if (kv == null) {
|
||||
return null;
|
||||
}
|
||||
return CellUtil.getValueArray(kv);
|
||||
return CellUtil.cloneValue(kv);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -572,7 +572,7 @@ public class Result implements CellScannable {
|
|||
}
|
||||
this.familyMap = new TreeMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>>(Bytes.BYTES_COMPARATOR);
|
||||
for(Cell kv : this.cells) {
|
||||
byte [] family = CellUtil.getFamilyArray(kv);
|
||||
byte [] family = CellUtil.cloneFamily(kv);
|
||||
NavigableMap<byte[], NavigableMap<Long, byte[]>> columnMap =
|
||||
familyMap.get(family);
|
||||
if(columnMap == null) {
|
||||
|
@ -580,7 +580,7 @@ public class Result implements CellScannable {
|
|||
(Bytes.BYTES_COMPARATOR);
|
||||
familyMap.put(family, columnMap);
|
||||
}
|
||||
byte [] qualifier = CellUtil.getQualifierArray(kv);
|
||||
byte [] qualifier = CellUtil.cloneQualifier(kv);
|
||||
NavigableMap<Long, byte[]> versionMap = columnMap.get(qualifier);
|
||||
if(versionMap == null) {
|
||||
versionMap = new TreeMap<Long, byte[]>(new Comparator<Long>() {
|
||||
|
@ -591,7 +591,7 @@ public class Result implements CellScannable {
|
|||
columnMap.put(qualifier, versionMap);
|
||||
}
|
||||
Long timestamp = kv.getTimestamp();
|
||||
byte [] value = CellUtil.getValueArray(kv);
|
||||
byte [] value = CellUtil.cloneValue(kv);
|
||||
|
||||
versionMap.put(timestamp, value);
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ public class Result implements CellScannable {
|
|||
if (isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return CellUtil.getValueArray(cells[0]);
|
||||
return CellUtil.cloneValue(cells[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -731,7 +731,7 @@ public class Result implements CellScannable {
|
|||
Cell[] replicatedKVs = res2.rawCells();
|
||||
for (int i = 0; i < res1.size(); i++) {
|
||||
if (!ourKVs[i].equals(replicatedKVs[i]) ||
|
||||
!Bytes.equals(CellUtil.getValueArray(ourKVs[i]), CellUtil.getValueArray(replicatedKVs[i]))) {
|
||||
!Bytes.equals(CellUtil.cloneValue(ourKVs[i]), CellUtil.cloneValue(replicatedKVs[i]))) {
|
||||
throw new Exception("This result was different: "
|
||||
+ res1.toString() + " compared to " + res2.toString());
|
||||
}
|
||||
|
|
|
@ -46,10 +46,10 @@ public class BigDecimalColumnInterpreter extends ColumnInterpreter<BigDecimal, B
|
|||
@Override
|
||||
public BigDecimal getValue(byte[] colFamily, byte[] colQualifier, Cell kv)
|
||||
throws IOException {
|
||||
if (kv == null || CellUtil.getValueArray(kv) == null) {
|
||||
if (kv == null || CellUtil.cloneValue(kv) == null) {
|
||||
return null;
|
||||
}
|
||||
return Bytes.toBigDecimal(CellUtil.getValueArray(kv)).setScale(2, RoundingMode.HALF_EVEN);
|
||||
return Bytes.toBigDecimal(CellUtil.cloneValue(kv)).setScale(2, RoundingMode.HALF_EVEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -190,7 +190,7 @@ public interface Cell {
|
|||
*
|
||||
* Added to ease transition from 0.94 -> 0.96.
|
||||
*
|
||||
* @deprecated as of 0.96, use {@link CellUtil#getValueArray(Cell)}
|
||||
* @deprecated as of 0.96, use {@link CellUtil#cloneValue(Cell)}
|
||||
*/
|
||||
@Deprecated
|
||||
byte[] getValue();
|
||||
|
@ -200,7 +200,7 @@ public interface Cell {
|
|||
*
|
||||
* Added to ease transition from 0.94 -> 0.96.
|
||||
*
|
||||
* @deprecated as of 0.96, use {@link CellUtil#getFamilyArray(Cell)}
|
||||
* @deprecated as of 0.96, use {@link CellUtil#cloneFamily(Cell)}
|
||||
*/
|
||||
@Deprecated
|
||||
byte[] getFamily();
|
||||
|
@ -210,7 +210,7 @@ public interface Cell {
|
|||
*
|
||||
* Added to ease transition from 0.94 -> 0.96.
|
||||
*
|
||||
* @deprecated as of 0.96, use {@link CellUtil#getQualifierArray(Cell)}
|
||||
* @deprecated as of 0.96, use {@link CellUtil#cloneQualifier(Cell)}
|
||||
*/
|
||||
@Deprecated
|
||||
byte[] getQualifier();
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.hadoop.hbase.util.Bytes;
|
|||
/**
|
||||
* Utility methods helpful slinging {@link Cell} instances.
|
||||
*/
|
||||
@InterfaceAudience.Private
|
||||
@InterfaceAudience.Public
|
||||
@InterfaceStability.Evolving
|
||||
public final class CellUtil {
|
||||
|
||||
|
@ -56,25 +56,25 @@ public final class CellUtil {
|
|||
|
||||
/***************** get individual arrays for tests ************/
|
||||
|
||||
public static byte[] getRowArray(Cell cell){
|
||||
public static byte[] cloneRow(Cell cell){
|
||||
byte[] output = new byte[cell.getRowLength()];
|
||||
copyRowTo(cell, output, 0);
|
||||
return output;
|
||||
}
|
||||
|
||||
public static byte[] getFamilyArray(Cell cell){
|
||||
public static byte[] cloneFamily(Cell cell){
|
||||
byte[] output = new byte[cell.getFamilyLength()];
|
||||
copyFamilyTo(cell, output, 0);
|
||||
return output;
|
||||
}
|
||||
|
||||
public static byte[] getQualifierArray(Cell cell){
|
||||
public static byte[] cloneQualifier(Cell cell){
|
||||
byte[] output = new byte[cell.getQualifierLength()];
|
||||
copyQualifierTo(cell, output, 0);
|
||||
return output;
|
||||
}
|
||||
|
||||
public static byte[] getValueArray(Cell cell){
|
||||
public static byte[] cloneValue(Cell cell){
|
||||
byte[] output = new byte[cell.getValueLength()];
|
||||
copyValueTo(cell, output, 0);
|
||||
return output;
|
||||
|
|
|
@ -1066,7 +1066,7 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
|
|||
*/
|
||||
@Deprecated // use CellUtil.getValueArray()
|
||||
public byte [] getValue() {
|
||||
return CellUtil.getValueArray(this);
|
||||
return CellUtil.cloneValue(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1079,7 +1079,7 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
|
|||
*/
|
||||
@Deprecated // use CellUtil.getRowArray()
|
||||
public byte [] getRow() {
|
||||
return CellUtil.getRowArray(this);
|
||||
return CellUtil.cloneRow(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1167,7 +1167,7 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
|
|||
*/
|
||||
@Deprecated // use CellUtil.getFamilyArray
|
||||
public byte [] getFamily() {
|
||||
return CellUtil.getFamilyArray(this);
|
||||
return CellUtil.cloneFamily(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1181,7 +1181,7 @@ public class KeyValue implements Cell, HeapSize, Cloneable {
|
|||
*/
|
||||
@Deprecated // use CellUtil.getQualifierArray
|
||||
public byte [] getQualifier() {
|
||||
return CellUtil.getQualifierArray(this);
|
||||
return CellUtil.cloneQualifier(this);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -189,8 +189,8 @@ public class KeyValueUtil {
|
|||
* @return previous key
|
||||
*/
|
||||
public static KeyValue previousKey(final KeyValue in) {
|
||||
return KeyValue.createFirstOnRow(CellUtil.getRowArray(in), CellUtil.getFamilyArray(in),
|
||||
CellUtil.getQualifierArray(in), in.getTimestamp() - 1);
|
||||
return KeyValue.createFirstOnRow(CellUtil.cloneRow(in), CellUtil.cloneFamily(in),
|
||||
CellUtil.cloneQualifier(in), in.getTimestamp() - 1);
|
||||
}
|
||||
|
||||
/*************** misc **********************************/
|
||||
|
|
|
@ -198,19 +198,19 @@ public class BulkDeleteEndpoint extends BulkDeleteService implements Coprocessor
|
|||
ts = timestamp;
|
||||
}
|
||||
// We just need the rowkey. Get it from 1st KV.
|
||||
byte[] row = CellUtil.getRowArray(deleteRow.get(0));
|
||||
byte[] row = CellUtil.cloneRow(deleteRow.get(0));
|
||||
Delete delete = new Delete(row, ts);
|
||||
if (deleteType == DeleteType.FAMILY) {
|
||||
Set<byte[]> families = new TreeSet<byte[]>(Bytes.BYTES_COMPARATOR);
|
||||
for (Cell kv : deleteRow) {
|
||||
if (families.add(CellUtil.getFamilyArray(kv))) {
|
||||
delete.deleteFamily(CellUtil.getFamilyArray(kv), ts);
|
||||
if (families.add(CellUtil.cloneFamily(kv))) {
|
||||
delete.deleteFamily(CellUtil.cloneFamily(kv), ts);
|
||||
}
|
||||
}
|
||||
} else if (deleteType == DeleteType.COLUMN) {
|
||||
Set<Column> columns = new HashSet<Column>();
|
||||
for (Cell kv : deleteRow) {
|
||||
Column column = new Column(CellUtil.getFamilyArray(kv), CellUtil.getQualifierArray(kv));
|
||||
Column column = new Column(CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv));
|
||||
if (columns.add(column)) {
|
||||
// Making deleteColumns() calls more than once for the same cf:qualifier is not correct
|
||||
// Every call to deleteColumns() will add a new KV to the familymap which will finally
|
||||
|
@ -226,13 +226,13 @@ public class BulkDeleteEndpoint extends BulkDeleteService implements Coprocessor
|
|||
int noOfVersionsToDelete = 0;
|
||||
if (timestamp == null) {
|
||||
for (Cell kv : deleteRow) {
|
||||
delete.deleteColumn(CellUtil.getFamilyArray(kv), CellUtil.getQualifierArray(kv), kv.getTimestamp());
|
||||
delete.deleteColumn(CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv), kv.getTimestamp());
|
||||
noOfVersionsToDelete++;
|
||||
}
|
||||
} else {
|
||||
Set<Column> columns = new HashSet<Column>();
|
||||
for (Cell kv : deleteRow) {
|
||||
Column column = new Column(CellUtil.getFamilyArray(kv), CellUtil.getQualifierArray(kv));
|
||||
Column column = new Column(CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv));
|
||||
// Only one version of particular column getting deleted.
|
||||
if (columns.add(column)) {
|
||||
delete.deleteColumn(column.family, column.qualifier, ts);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class RowCountEndpoint extends ExampleProtos.RowCountService
|
|||
do {
|
||||
hasMore = scanner.next(results);
|
||||
for (Cell kv : results) {
|
||||
byte[] currentRow = CellUtil.getRowArray(kv);
|
||||
byte[] currentRow = CellUtil.cloneRow(kv);
|
||||
if (lastRow == null || !Bytes.equals(lastRow, currentRow)) {
|
||||
lastRow = currentRow;
|
||||
count++;
|
||||
|
|
|
@ -471,7 +471,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
|
|||
long chainId = Bytes.toLong(entry.getKey());
|
||||
long next = Bytes.toLong(entry.getValue());
|
||||
Cell c = value.getColumn(SORT_FAM, entry.getKey()).get(0);
|
||||
long order = Bytes.toLong(CellUtil.getValueArray(c));
|
||||
long order = Bytes.toLong(CellUtil.cloneValue(c));
|
||||
context.write(new LinkKey(chainId, order), new LinkChain(longRk, next));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,22 +187,22 @@ public class PrefixTreeCell implements Cell, Comparable<Cell> {
|
|||
/* Deprecated methods pushed into the Cell interface */
|
||||
@Override
|
||||
public byte[] getValue() {
|
||||
return CellUtil.getValueArray(this);
|
||||
return CellUtil.cloneValue(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getFamily() {
|
||||
return CellUtil.getFamilyArray(this);
|
||||
return CellUtil.cloneFamily(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getQualifier() {
|
||||
return CellUtil.getQualifierArray(this);
|
||||
return CellUtil.cloneQualifier(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getRow() {
|
||||
return CellUtil.getRowArray(this);
|
||||
return CellUtil.cloneRow(this);
|
||||
}
|
||||
|
||||
/************************* helper methods *************************/
|
||||
|
|
|
@ -117,11 +117,11 @@ implements TableMap<ImmutableBytesWritable,Result> {
|
|||
int numCols = columns.length;
|
||||
if (numCols > 0) {
|
||||
for (Cell value: r.listCells()) {
|
||||
byte [] column = KeyValue.makeColumn(CellUtil.getFamilyArray(value),
|
||||
CellUtil.getQualifierArray(value));
|
||||
byte [] column = KeyValue.makeColumn(CellUtil.cloneFamily(value),
|
||||
CellUtil.cloneQualifier(value));
|
||||
for (int i = 0; i < numCols; i++) {
|
||||
if (Bytes.equals(column, columns[i])) {
|
||||
foundList.add(CellUtil.getValueArray(value));
|
||||
foundList.add(CellUtil.cloneValue(value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,8 +117,8 @@ public class CellCounter {
|
|||
context.write(new Text("Total ROWS"), new IntWritable(1));
|
||||
|
||||
for (Cell value : values.listCells()) {
|
||||
currentRowKey = Bytes.toStringBinary(CellUtil.getRowArray(value));
|
||||
String thisRowFamilyName = Bytes.toStringBinary(CellUtil.getFamilyArray(value));
|
||||
currentRowKey = Bytes.toStringBinary(CellUtil.cloneRow(value));
|
||||
String thisRowFamilyName = Bytes.toStringBinary(CellUtil.cloneFamily(value));
|
||||
if (!thisRowFamilyName.equals(currentFamilyName)) {
|
||||
currentFamilyName = thisRowFamilyName;
|
||||
context.getCounter("CF", thisRowFamilyName).increment(1);
|
||||
|
@ -127,7 +127,7 @@ public class CellCounter {
|
|||
context.write(new Text(thisRowFamilyName), new IntWritable(1));
|
||||
}
|
||||
String thisRowQualifierName = thisRowFamilyName + separator
|
||||
+ Bytes.toStringBinary(CellUtil.getQualifierArray(value));
|
||||
+ Bytes.toStringBinary(CellUtil.cloneQualifier(value));
|
||||
if (!thisRowQualifierName.equals(currentQualifierName)) {
|
||||
currentQualifierName = thisRowQualifierName;
|
||||
context.getCounter("CFQL", thisRowQualifierName).increment(1);
|
||||
|
|
|
@ -110,11 +110,11 @@ extends TableMapper<ImmutableBytesWritable,Result> implements Configurable {
|
|||
int numCols = columns.length;
|
||||
if (numCols > 0) {
|
||||
for (Cell value: r.listCells()) {
|
||||
byte [] column = KeyValue.makeColumn(CellUtil.getFamilyArray(value),
|
||||
CellUtil.getQualifierArray(value));
|
||||
byte [] column = KeyValue.makeColumn(CellUtil.cloneFamily(value),
|
||||
CellUtil.cloneQualifier(value));
|
||||
for (int i = 0; i < numCols; i++) {
|
||||
if (Bytes.equals(column, columns[i])) {
|
||||
foundList.add(CellUtil.getValueArray(value));
|
||||
foundList.add(CellUtil.cloneValue(value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ public class Import {
|
|||
private static Cell convertKv(Cell kv, Map<byte[], byte[]> cfRenameMap) {
|
||||
if(cfRenameMap != null) {
|
||||
// If there's a rename mapping for this CF, create a new KeyValue
|
||||
byte[] newCfName = cfRenameMap.get(CellUtil.getFamilyArray(kv));
|
||||
byte[] newCfName = cfRenameMap.get(CellUtil.cloneFamily(kv));
|
||||
if(newCfName != null) {
|
||||
kv = new KeyValue(kv.getRowArray(), // row buffer
|
||||
kv.getRowOffset(), // row offset
|
||||
|
|
|
@ -96,7 +96,7 @@ public class TableNamespaceManager {
|
|||
ResultScanner scanner = table.getScanner(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES);
|
||||
try {
|
||||
for(Result result : scanner) {
|
||||
byte[] val = CellUtil.getValueArray(result.getColumnLatest(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||
byte[] val = CellUtil.cloneValue(result.getColumnLatest(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||
HTableDescriptor.NAMESPACE_COL_DESC_BYTES));
|
||||
NamespaceDescriptor ns =
|
||||
ProtobufUtil.toNamespaceDescriptor(
|
||||
|
@ -114,7 +114,7 @@ public class TableNamespaceManager {
|
|||
if (res.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
byte[] val = CellUtil.getValueArray(res.getColumnLatest(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||
byte[] val = CellUtil.cloneValue(res.getColumnLatest(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||
HTableDescriptor.NAMESPACE_COL_DESC_BYTES));
|
||||
return
|
||||
ProtobufUtil.toNamespaceDescriptor(
|
||||
|
@ -192,7 +192,7 @@ public class TableNamespaceManager {
|
|||
ResultScanner scanner = table.getScanner(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES);
|
||||
try {
|
||||
for(Result r : scanner) {
|
||||
byte[] val = CellUtil.getValueArray(r.getColumnLatest(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||
byte[] val = CellUtil.cloneValue(r.getColumnLatest(HTableDescriptor.NAMESPACE_FAMILY_INFO_BYTES,
|
||||
HTableDescriptor.NAMESPACE_COL_DESC_BYTES));
|
||||
ret.add(ProtobufUtil.toNamespaceDescriptor(
|
||||
HBaseProtos.NamespaceDescriptor.parseFrom(val)));
|
||||
|
|
|
@ -4871,7 +4871,7 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
// found, otherwise add new column initialized to the increment amount
|
||||
int idx = 0;
|
||||
for (Cell kv: family.getValue()) {
|
||||
long amount = Bytes.toLong(CellUtil.getValueArray(kv));
|
||||
long amount = Bytes.toLong(CellUtil.cloneValue(kv));
|
||||
if (idx < results.size() && CellUtil.matchingQualifier(results.get(idx), kv)) {
|
||||
Cell c = results.get(idx);
|
||||
if(c.getValueLength() == Bytes.SIZEOF_LONG) {
|
||||
|
@ -4886,7 +4886,7 @@ public class HRegion implements HeapSize { // , Writable{
|
|||
|
||||
// Append new incremented KeyValue to list
|
||||
KeyValue newKV =
|
||||
new KeyValue(row, family.getKey(), CellUtil.getQualifierArray(kv), now, Bytes.toBytes(amount));
|
||||
new KeyValue(row, family.getKey(), CellUtil.cloneQualifier(kv), now, Bytes.toBytes(amount));
|
||||
newKV.setMvccVersion(w.getWriteNumber());
|
||||
kvs.add(newKV);
|
||||
|
||||
|
|
|
@ -86,9 +86,9 @@ public class MultiRowResource extends ResourceBase {
|
|||
RowModel rowModel = new RowModel(rk);
|
||||
|
||||
while ((value = generator.next()) != null) {
|
||||
rowModel.addCell(new CellModel(CellUtil.getFamilyArray(value),
|
||||
CellUtil.getQualifierArray(value),
|
||||
value.getTimestamp(), CellUtil.getValueArray(value)));
|
||||
rowModel.addCell(new CellModel(CellUtil.cloneFamily(value),
|
||||
CellUtil.cloneQualifier(value),
|
||||
value.getTimestamp(), CellUtil.cloneValue(value)));
|
||||
}
|
||||
|
||||
model.addRow(rowModel);
|
||||
|
|
|
@ -99,16 +99,16 @@ public class RowResource extends ResourceBase {
|
|||
int count = 0;
|
||||
CellSetModel model = new CellSetModel();
|
||||
Cell value = generator.next();
|
||||
byte[] rowKey = CellUtil.getRowArray(value);
|
||||
byte[] rowKey = CellUtil.cloneRow(value);
|
||||
RowModel rowModel = new RowModel(rowKey);
|
||||
do {
|
||||
if (!Bytes.equals(CellUtil.getRowArray(value), rowKey)) {
|
||||
if (!Bytes.equals(CellUtil.cloneRow(value), rowKey)) {
|
||||
model.addRow(rowModel);
|
||||
rowKey = CellUtil.getRowArray(value);
|
||||
rowKey = CellUtil.cloneRow(value);
|
||||
rowModel = new RowModel(rowKey);
|
||||
}
|
||||
rowModel.addCell(new CellModel(CellUtil.getFamilyArray(value), CellUtil.getQualifierArray(value),
|
||||
value.getTimestamp(), CellUtil.getValueArray(value)));
|
||||
rowModel.addCell(new CellModel(CellUtil.cloneFamily(value), CellUtil.cloneQualifier(value),
|
||||
value.getTimestamp(), CellUtil.cloneValue(value)));
|
||||
if (++count > rowspec.getMaxValues()) {
|
||||
break;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public class RowResource extends ResourceBase {
|
|||
.build();
|
||||
}
|
||||
Cell value = generator.next();
|
||||
ResponseBuilder response = Response.ok(CellUtil.getValueArray(value));
|
||||
ResponseBuilder response = Response.ok(CellUtil.cloneValue(value));
|
||||
response.header("X-Timestamp", value.getTimestamp());
|
||||
servlet.getMetrics().incrementSucessfulGetRequests(1);
|
||||
return response.build();
|
||||
|
|
|
@ -117,10 +117,10 @@ public class ScannerInstanceResource extends ResourceBase {
|
|||
break;
|
||||
}
|
||||
if (rowKey == null) {
|
||||
rowKey = CellUtil.getRowArray(value);
|
||||
rowKey = CellUtil.cloneRow(value);
|
||||
rowModel = new RowModel(rowKey);
|
||||
}
|
||||
if (!Bytes.equals(CellUtil.getRowArray(value), rowKey)) {
|
||||
if (!Bytes.equals(CellUtil.cloneRow(value), rowKey)) {
|
||||
// if maxRows was given as a query param, stop if we would exceed the
|
||||
// specified number of rows
|
||||
if (maxRows > 0) {
|
||||
|
@ -130,12 +130,12 @@ public class ScannerInstanceResource extends ResourceBase {
|
|||
}
|
||||
}
|
||||
model.addRow(rowModel);
|
||||
rowKey = CellUtil.getRowArray(value);
|
||||
rowKey = CellUtil.cloneRow(value);
|
||||
rowModel = new RowModel(rowKey);
|
||||
}
|
||||
rowModel.addCell(
|
||||
new CellModel(CellUtil.getFamilyArray(value), CellUtil.getQualifierArray(value),
|
||||
value.getTimestamp(), CellUtil.getValueArray(value)));
|
||||
new CellModel(CellUtil.cloneFamily(value), CellUtil.cloneQualifier(value),
|
||||
value.getTimestamp(), CellUtil.cloneValue(value)));
|
||||
} while (--count > 0);
|
||||
model.addRow(rowModel);
|
||||
ResponseBuilder response = Response.ok(model);
|
||||
|
@ -158,12 +158,12 @@ public class ScannerInstanceResource extends ResourceBase {
|
|||
LOG.info("generator exhausted");
|
||||
return Response.noContent().build();
|
||||
}
|
||||
ResponseBuilder response = Response.ok(CellUtil.getValueArray(value));
|
||||
ResponseBuilder response = Response.ok(CellUtil.cloneValue(value));
|
||||
response.cacheControl(cacheControl);
|
||||
response.header("X-Row", Base64.encodeBytes(CellUtil.getRowArray(value)));
|
||||
response.header("X-Row", Base64.encodeBytes(CellUtil.cloneRow(value)));
|
||||
response.header("X-Column",
|
||||
Base64.encodeBytes(
|
||||
KeyValue.makeColumn(CellUtil.getFamilyArray(value), CellUtil.getQualifierArray(value))));
|
||||
KeyValue.makeColumn(CellUtil.cloneFamily(value), CellUtil.cloneQualifier(value))));
|
||||
response.header("X-Timestamp", value.getTimestamp());
|
||||
servlet.getMetrics().incrementSucessfulGetRequests(1);
|
||||
return response.build();
|
||||
|
|
|
@ -376,7 +376,7 @@ public class AccessControlLists {
|
|||
byte[] entry = null;
|
||||
for (Cell kv : row) {
|
||||
if (entry == null) {
|
||||
entry = CellUtil.getRowArray(kv);
|
||||
entry = CellUtil.cloneRow(kv);
|
||||
}
|
||||
Pair<String,TablePermission> permissionsOfUserOnTable =
|
||||
parsePermissionRecord(entry, kv);
|
||||
|
@ -531,14 +531,14 @@ public class AccessControlLists {
|
|||
private static Pair<String, TablePermission> parsePermissionRecord(
|
||||
byte[] entryName, Cell kv) {
|
||||
// return X given a set of permissions encoded in the permissionRecord kv.
|
||||
byte[] family = CellUtil.getFamilyArray(kv);
|
||||
byte[] family = CellUtil.cloneFamily(kv);
|
||||
|
||||
if (!Bytes.equals(family, ACL_LIST_FAMILY)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] key = CellUtil.getQualifierArray(kv);
|
||||
byte[] value = CellUtil.getValueArray(kv);
|
||||
byte[] key = CellUtil.cloneQualifier(kv);
|
||||
byte[] value = CellUtil.cloneValue(kv);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Read acl: kv ["+
|
||||
Bytes.toStringBinary(key)+": "+
|
||||
|
|
|
@ -103,7 +103,7 @@ public class ThriftUtilities {
|
|||
static public List<TCell> cellFromHBase(Cell in) {
|
||||
List<TCell> list = new ArrayList<TCell>(1);
|
||||
if (in != null) {
|
||||
list.add(new TCell(ByteBuffer.wrap(CellUtil.getValueArray(in)), in.getTimestamp()));
|
||||
list.add(new TCell(ByteBuffer.wrap(CellUtil.cloneValue(in)), in.getTimestamp()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class ThriftUtilities {
|
|||
if (in != null) {
|
||||
list = new ArrayList<TCell>(in.length);
|
||||
for (int i = 0; i < in.length; i++) {
|
||||
list.add(new TCell(ByteBuffer.wrap(CellUtil.getValueArray(in[i])), in[i].getTimestamp()));
|
||||
list.add(new TCell(ByteBuffer.wrap(CellUtil.cloneValue(in[i])), in[i].getTimestamp()));
|
||||
}
|
||||
} else {
|
||||
list = new ArrayList<TCell>(0);
|
||||
|
@ -154,17 +154,17 @@ public class ThriftUtilities {
|
|||
result.sortedColumns = new ArrayList<TColumn>();
|
||||
for (Cell kv : result_.rawCells()) {
|
||||
result.sortedColumns.add(new TColumn(
|
||||
ByteBuffer.wrap(KeyValue.makeColumn(CellUtil.getFamilyArray(kv),
|
||||
CellUtil.getQualifierArray(kv))),
|
||||
new TCell(ByteBuffer.wrap(CellUtil.getValueArray(kv)), kv.getTimestamp())));
|
||||
ByteBuffer.wrap(KeyValue.makeColumn(CellUtil.cloneFamily(kv),
|
||||
CellUtil.cloneQualifier(kv))),
|
||||
new TCell(ByteBuffer.wrap(CellUtil.cloneValue(kv)), kv.getTimestamp())));
|
||||
}
|
||||
} else {
|
||||
result.columns = new TreeMap<ByteBuffer, TCell>();
|
||||
for (Cell kv : result_.rawCells()) {
|
||||
result.columns.put(
|
||||
ByteBuffer.wrap(KeyValue.makeColumn(CellUtil.getFamilyArray(kv),
|
||||
CellUtil.getQualifierArray(kv))),
|
||||
new TCell(ByteBuffer.wrap(CellUtil.getValueArray(kv)), kv.getTimestamp()));
|
||||
ByteBuffer.wrap(KeyValue.makeColumn(CellUtil.cloneFamily(kv),
|
||||
CellUtil.cloneQualifier(kv))),
|
||||
new TCell(ByteBuffer.wrap(CellUtil.cloneValue(kv)), kv.getTimestamp()));
|
||||
}
|
||||
}
|
||||
results.add(result);
|
||||
|
|
|
@ -149,10 +149,10 @@ public class ThriftUtilities {
|
|||
List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
|
||||
for (Cell kv : raw) {
|
||||
TColumnValue col = new TColumnValue();
|
||||
col.setFamily(CellUtil.getFamilyArray(kv));
|
||||
col.setQualifier(CellUtil.getQualifierArray(kv));
|
||||
col.setFamily(CellUtil.cloneFamily(kv));
|
||||
col.setQualifier(CellUtil.cloneQualifier(kv));
|
||||
col.setTimestamp(kv.getTimestamp());
|
||||
col.setValue(CellUtil.getValueArray(kv));
|
||||
col.setValue(CellUtil.cloneValue(kv));
|
||||
columnValues.add(col);
|
||||
}
|
||||
out.setColumnValues(columnValues);
|
||||
|
|
|
@ -176,7 +176,7 @@ public class TestAcidGuarantees implements Tool {
|
|||
for (Cell kv : res.listCells()) {
|
||||
msg.append(kv.toString());
|
||||
msg.append(" val= ");
|
||||
msg.append(Bytes.toStringBinary(CellUtil.getValueArray(kv)));
|
||||
msg.append(Bytes.toStringBinary(CellUtil.cloneValue(kv)));
|
||||
msg.append("\n");
|
||||
}
|
||||
throw new RuntimeException(msg.toString());
|
||||
|
@ -233,7 +233,7 @@ public class TestAcidGuarantees implements Tool {
|
|||
for (Cell kv : res.listCells()) {
|
||||
msg.append(kv.toString());
|
||||
msg.append(" val= ");
|
||||
msg.append(Bytes.toStringBinary(CellUtil.getValueArray(kv)));
|
||||
msg.append(Bytes.toStringBinary(CellUtil.cloneValue(kv)));
|
||||
msg.append("\n");
|
||||
}
|
||||
throw new RuntimeException(msg.toString());
|
||||
|
|
|
@ -107,7 +107,7 @@ public class TimestampTestBase extends HBaseTestCase {
|
|||
get.setMaxVersions(3);
|
||||
Result result = incommon.get(get);
|
||||
assertEquals(1, result.size());
|
||||
long time = Bytes.toLong(CellUtil.getValueArray(result.rawCells()[0]));
|
||||
long time = Bytes.toLong(CellUtil.cloneValue(result.rawCells()[0]));
|
||||
assertEquals(time, currentTime);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class TimestampTestBase extends HBaseTestCase {
|
|||
Cell [] kvs = result.rawCells();
|
||||
assertEquals(kvs.length, tss.length);
|
||||
for(int i=0;i<kvs.length;i++) {
|
||||
t = Bytes.toLong(CellUtil.getValueArray(kvs[i]));
|
||||
t = Bytes.toLong(CellUtil.cloneValue(kvs[i]));
|
||||
assertEquals(tss[i], t);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ public class TimestampTestBase extends HBaseTestCase {
|
|||
kvs = result.rawCells();
|
||||
assertEquals(kvs.length, tss.length - 1);
|
||||
for(int i=1;i<kvs.length;i++) {
|
||||
t = Bytes.toLong(CellUtil.getValueArray(kvs[i-1]));
|
||||
t = Bytes.toLong(CellUtil.cloneValue(kvs[i-1]));
|
||||
assertEquals(tss[i], t);
|
||||
}
|
||||
|
||||
|
|
|
@ -208,8 +208,8 @@ public class TestFromClientSide {
|
|||
s.setMaxVersions();
|
||||
ResultScanner scanner = h.getScanner(s);
|
||||
Cell[] kvs = scanner.next().rawCells();
|
||||
assertArrayEquals(T2, CellUtil.getValueArray(kvs[0]));
|
||||
assertArrayEquals(T1, CellUtil.getValueArray(kvs[1]));
|
||||
assertArrayEquals(T2, CellUtil.cloneValue(kvs[0]));
|
||||
assertArrayEquals(T1, CellUtil.cloneValue(kvs[1]));
|
||||
scanner.close();
|
||||
|
||||
s = new Scan(T1);
|
||||
|
@ -218,10 +218,10 @@ public class TestFromClientSide {
|
|||
scanner = h.getScanner(s);
|
||||
kvs = scanner.next().rawCells();
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs[0]));
|
||||
assertArrayEquals(T3, CellUtil.getValueArray(kvs[1]));
|
||||
assertArrayEquals(T3, CellUtil.cloneValue(kvs[1]));
|
||||
assertTrue(CellUtil.isDelete(kvs[2]));
|
||||
assertArrayEquals(T2, CellUtil.getValueArray(kvs[3]));
|
||||
assertArrayEquals(T1, CellUtil.getValueArray(kvs[4]));
|
||||
assertArrayEquals(T2, CellUtil.cloneValue(kvs[3]));
|
||||
assertArrayEquals(T1, CellUtil.cloneValue(kvs[4]));
|
||||
scanner.close();
|
||||
h.close();
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ public class TestFromClientSide {
|
|||
System.out.println("Got back key: " + Bytes.toString(result.getRow()));
|
||||
for (Cell kv : result.rawCells()) {
|
||||
System.out.println("kv=" + kv.toString() + ", "
|
||||
+ Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
+ Bytes.toString(CellUtil.cloneValue(kv)));
|
||||
}
|
||||
numberOfResults++;
|
||||
}
|
||||
|
@ -748,8 +748,8 @@ public class TestFromClientSide {
|
|||
int expectedIndex = 1;
|
||||
for(Result result : ht.getScanner(scan)) {
|
||||
assertEquals(result.size(), 1);
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[0]), ROWS[expectedIndex]));
|
||||
assertTrue(Bytes.equals(CellUtil.getQualifierArray(result.rawCells()[0]),
|
||||
assertTrue(Bytes.equals(CellUtil.cloneRow(result.rawCells()[0]), ROWS[expectedIndex]));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneQualifier(result.rawCells()[0]),
|
||||
QUALIFIERS[expectedIndex]));
|
||||
expectedIndex++;
|
||||
}
|
||||
|
@ -784,7 +784,7 @@ public class TestFromClientSide {
|
|||
for(Result result : ht.getScanner(scan)) {
|
||||
assertEquals(result.size(), 1);
|
||||
assertEquals(result.rawCells()[0].getValueLength(), Bytes.SIZEOF_INT);
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(result.rawCells()[0])), VALUE.length);
|
||||
assertEquals(Bytes.toInt(CellUtil.cloneValue(result.rawCells()[0])), VALUE.length);
|
||||
count++;
|
||||
}
|
||||
assertEquals(count, 10);
|
||||
|
@ -2135,15 +2135,15 @@ public class TestFromClientSide {
|
|||
result = scanner.next();
|
||||
assertTrue("Expected 1 key but received " + result.size(),
|
||||
result.size() == 1);
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[0]), ROWS[3]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.rawCells()[0]), VALUES[0]));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneRow(result.rawCells()[0]), ROWS[3]));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneValue(result.rawCells()[0]), VALUES[0]));
|
||||
result = scanner.next();
|
||||
assertTrue("Expected 2 keys but received " + result.size(),
|
||||
result.size() == 2);
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[0]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.getRowArray(result.rawCells()[1]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.rawCells()[0]), VALUES[1]));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(result.rawCells()[1]), VALUES[2]));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneRow(result.rawCells()[0]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneRow(result.rawCells()[1]), ROWS[4]));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneValue(result.rawCells()[0]), VALUES[1]));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneValue(result.rawCells()[1]), VALUES[2]));
|
||||
scanner.close();
|
||||
|
||||
// Add test of bulk deleting.
|
||||
|
@ -3088,34 +3088,34 @@ public class TestFromClientSide {
|
|||
byte [] qualifier, byte [] value)
|
||||
throws Exception {
|
||||
assertTrue("Expected row [" + Bytes.toString(row) + "] " +
|
||||
"Got row [" + Bytes.toString(CellUtil.getRowArray(key)) +"]",
|
||||
equals(row, CellUtil.getRowArray(key)));
|
||||
"Got row [" + Bytes.toString(CellUtil.cloneRow(key)) +"]",
|
||||
equals(row, CellUtil.cloneRow(key)));
|
||||
assertTrue("Expected family [" + Bytes.toString(family) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(key)) + "]",
|
||||
equals(family, CellUtil.getFamilyArray(key)));
|
||||
"Got family [" + Bytes.toString(CellUtil.cloneFamily(key)) + "]",
|
||||
equals(family, CellUtil.cloneFamily(key)));
|
||||
assertTrue("Expected qualifier [" + Bytes.toString(qualifier) + "] " +
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.getQualifierArray(key)) + "]",
|
||||
equals(qualifier, CellUtil.getQualifierArray(key)));
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.cloneQualifier(key)) + "]",
|
||||
equals(qualifier, CellUtil.cloneQualifier(key)));
|
||||
assertTrue("Expected value [" + Bytes.toString(value) + "] " +
|
||||
"Got value [" + Bytes.toString(CellUtil.getValueArray(key)) + "]",
|
||||
equals(value, CellUtil.getValueArray(key)));
|
||||
"Got value [" + Bytes.toString(CellUtil.cloneValue(key)) + "]",
|
||||
equals(value, CellUtil.cloneValue(key)));
|
||||
}
|
||||
|
||||
private void assertIncrementKey(Cell key, byte [] row, byte [] family,
|
||||
byte [] qualifier, long value)
|
||||
throws Exception {
|
||||
assertTrue("Expected row [" + Bytes.toString(row) + "] " +
|
||||
"Got row [" + Bytes.toString(CellUtil.getRowArray(key)) +"]",
|
||||
equals(row, CellUtil.getRowArray(key)));
|
||||
"Got row [" + Bytes.toString(CellUtil.cloneRow(key)) +"]",
|
||||
equals(row, CellUtil.cloneRow(key)));
|
||||
assertTrue("Expected family [" + Bytes.toString(family) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(key)) + "]",
|
||||
equals(family, CellUtil.getFamilyArray(key)));
|
||||
"Got family [" + Bytes.toString(CellUtil.cloneFamily(key)) + "]",
|
||||
equals(family, CellUtil.cloneFamily(key)));
|
||||
assertTrue("Expected qualifier [" + Bytes.toString(qualifier) + "] " +
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.getQualifierArray(key)) + "]",
|
||||
equals(qualifier, CellUtil.getQualifierArray(key)));
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.cloneQualifier(key)) + "]",
|
||||
equals(qualifier, CellUtil.cloneQualifier(key)));
|
||||
assertTrue("Expected value [" + value + "] " +
|
||||
"Got value [" + Bytes.toLong(CellUtil.getValueArray(key)) + "]",
|
||||
Bytes.toLong(CellUtil.getValueArray(key)) == value);
|
||||
"Got value [" + Bytes.toLong(CellUtil.cloneValue(key)) + "]",
|
||||
Bytes.toLong(CellUtil.cloneValue(key)) == value);
|
||||
}
|
||||
|
||||
private void assertNumKeys(Result result, int n) throws Exception {
|
||||
|
@ -3141,9 +3141,9 @@ public class TestFromClientSide {
|
|||
byte [] value = values[idxs[i][2]];
|
||||
Cell key = keys[i];
|
||||
|
||||
byte[] famb = CellUtil.getFamilyArray(key);
|
||||
byte[] qualb = CellUtil.getQualifierArray(key);
|
||||
byte[] valb = CellUtil.getValueArray(key);
|
||||
byte[] famb = CellUtil.cloneFamily(key);
|
||||
byte[] qualb = CellUtil.cloneQualifier(key);
|
||||
byte[] valb = CellUtil.cloneValue(key);
|
||||
assertTrue("(" + i + ") Expected family [" + Bytes.toString(family)
|
||||
+ "] " + "Got family [" + Bytes.toString(famb) + "]",
|
||||
equals(family, famb));
|
||||
|
@ -3174,15 +3174,15 @@ public class TestFromClientSide {
|
|||
Cell key = keys[i];
|
||||
|
||||
assertTrue("(" + i + ") Expected family [" + Bytes.toString(family)
|
||||
+ "] " + "Got family [" + Bytes.toString(CellUtil.getFamilyArray(key)) + "]",
|
||||
+ "] " + "Got family [" + Bytes.toString(CellUtil.cloneFamily(key)) + "]",
|
||||
CellUtil.matchingFamily(key, family));
|
||||
assertTrue("(" + i + ") Expected qualifier [" + Bytes.toString(qualifier)
|
||||
+ "] " + "Got qualifier [" + Bytes.toString(CellUtil.getQualifierArray(key))+ "]",
|
||||
+ "] " + "Got qualifier [" + Bytes.toString(CellUtil.cloneQualifier(key))+ "]",
|
||||
CellUtil.matchingQualifier(key, qualifier));
|
||||
assertTrue("Expected ts [" + ts + "] " +
|
||||
"Got ts [" + key.getTimestamp() + "]", ts == key.getTimestamp());
|
||||
assertTrue("(" + i + ") Expected value [" + Bytes.toString(value) + "] "
|
||||
+ "Got value [" + Bytes.toString(CellUtil.getValueArray(key)) + "]",
|
||||
+ "Got value [" + Bytes.toString(CellUtil.cloneValue(key)) + "]",
|
||||
CellUtil.matchingValue(key, value));
|
||||
}
|
||||
}
|
||||
|
@ -3203,24 +3203,24 @@ public class TestFromClientSide {
|
|||
Cell [] kv = result.rawCells();
|
||||
Cell kvA = kv[0];
|
||||
assertTrue("(A) Expected family [" + Bytes.toString(familyA) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(kvA)) + "]",
|
||||
equals(familyA, CellUtil.getFamilyArray(kvA)));
|
||||
"Got family [" + Bytes.toString(CellUtil.cloneFamily(kvA)) + "]",
|
||||
equals(familyA, CellUtil.cloneFamily(kvA)));
|
||||
assertTrue("(A) Expected qualifier [" + Bytes.toString(qualifierA) + "] " +
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.getQualifierArray(kvA)) + "]",
|
||||
equals(qualifierA, CellUtil.getQualifierArray(kvA)));
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.cloneQualifier(kvA)) + "]",
|
||||
equals(qualifierA, CellUtil.cloneQualifier(kvA)));
|
||||
assertTrue("(A) Expected value [" + Bytes.toString(valueA) + "] " +
|
||||
"Got value [" + Bytes.toString(CellUtil.getValueArray(kvA)) + "]",
|
||||
equals(valueA, CellUtil.getValueArray(kvA)));
|
||||
"Got value [" + Bytes.toString(CellUtil.cloneValue(kvA)) + "]",
|
||||
equals(valueA, CellUtil.cloneValue(kvA)));
|
||||
Cell kvB = kv[1];
|
||||
assertTrue("(B) Expected family [" + Bytes.toString(familyB) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(kvB)) + "]",
|
||||
equals(familyB, CellUtil.getFamilyArray(kvB)));
|
||||
"Got family [" + Bytes.toString(CellUtil.cloneFamily(kvB)) + "]",
|
||||
equals(familyB, CellUtil.cloneFamily(kvB)));
|
||||
assertTrue("(B) Expected qualifier [" + Bytes.toString(qualifierB) + "] " +
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.getQualifierArray(kvB)) + "]",
|
||||
equals(qualifierB, CellUtil.getQualifierArray(kvB)));
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.cloneQualifier(kvB)) + "]",
|
||||
equals(qualifierB, CellUtil.cloneQualifier(kvB)));
|
||||
assertTrue("(B) Expected value [" + Bytes.toString(valueB) + "] " +
|
||||
"Got value [" + Bytes.toString(CellUtil.getValueArray(kvB)) + "]",
|
||||
equals(valueB, CellUtil.getValueArray(kvB)));
|
||||
"Got value [" + Bytes.toString(CellUtil.cloneValue(kvB)) + "]",
|
||||
equals(valueB, CellUtil.cloneValue(kvB)));
|
||||
}
|
||||
|
||||
private void assertSingleResult(Result result, byte [] row, byte [] family,
|
||||
|
@ -3233,14 +3233,14 @@ public class TestFromClientSide {
|
|||
result.size() == 1);
|
||||
Cell kv = result.rawCells()[0];
|
||||
assertTrue("Expected family [" + Bytes.toString(family) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(kv)) + "]",
|
||||
equals(family, CellUtil.getFamilyArray(kv)));
|
||||
"Got family [" + Bytes.toString(CellUtil.cloneFamily(kv)) + "]",
|
||||
equals(family, CellUtil.cloneFamily(kv)));
|
||||
assertTrue("Expected qualifier [" + Bytes.toString(qualifier) + "] " +
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.getQualifierArray(kv)) + "]",
|
||||
equals(qualifier, CellUtil.getQualifierArray(kv)));
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.cloneQualifier(kv)) + "]",
|
||||
equals(qualifier, CellUtil.cloneQualifier(kv)));
|
||||
assertTrue("Expected value [" + Bytes.toString(value) + "] " +
|
||||
"Got value [" + Bytes.toString(CellUtil.getValueArray(kv)) + "]",
|
||||
equals(value, CellUtil.getValueArray(kv)));
|
||||
"Got value [" + Bytes.toString(CellUtil.cloneValue(kv)) + "]",
|
||||
equals(value, CellUtil.cloneValue(kv)));
|
||||
}
|
||||
|
||||
private void assertSingleResult(Result result, byte [] row, byte [] family,
|
||||
|
@ -3253,16 +3253,16 @@ public class TestFromClientSide {
|
|||
result.size() == 1);
|
||||
Cell kv = result.rawCells()[0];
|
||||
assertTrue("Expected family [" + Bytes.toString(family) + "] " +
|
||||
"Got family [" + Bytes.toString(CellUtil.getFamilyArray(kv)) + "]",
|
||||
equals(family, CellUtil.getFamilyArray(kv)));
|
||||
"Got family [" + Bytes.toString(CellUtil.cloneFamily(kv)) + "]",
|
||||
equals(family, CellUtil.cloneFamily(kv)));
|
||||
assertTrue("Expected qualifier [" + Bytes.toString(qualifier) + "] " +
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.getQualifierArray(kv)) + "]",
|
||||
equals(qualifier, CellUtil.getQualifierArray(kv)));
|
||||
"Got qualifier [" + Bytes.toString(CellUtil.cloneQualifier(kv)) + "]",
|
||||
equals(qualifier, CellUtil.cloneQualifier(kv)));
|
||||
assertTrue("Expected ts [" + ts + "] " +
|
||||
"Got ts [" + kv.getTimestamp() + "]", ts == kv.getTimestamp());
|
||||
assertTrue("Expected value [" + Bytes.toString(value) + "] " +
|
||||
"Got value [" + Bytes.toString(CellUtil.getValueArray(kv)) + "]",
|
||||
equals(value, CellUtil.getValueArray(kv)));
|
||||
"Got value [" + Bytes.toString(CellUtil.cloneValue(kv)) + "]",
|
||||
equals(value, CellUtil.cloneValue(kv)));
|
||||
}
|
||||
|
||||
private void assertEmptyResult(Result result) throws Exception {
|
||||
|
|
|
@ -188,8 +188,8 @@ public class TestMultiParallel {
|
|||
Cell[] multiKvs = multiRes[i].rawCells();
|
||||
for (int j = 0; j < singleKvs.length; j++) {
|
||||
Assert.assertEquals(singleKvs[j], multiKvs[j]);
|
||||
Assert.assertEquals(0, Bytes.compareTo(CellUtil.getValueArray(singleKvs[j]),
|
||||
CellUtil.getValueArray(multiKvs[j])));
|
||||
Assert.assertEquals(0, Bytes.compareTo(CellUtil.cloneValue(singleKvs[j]),
|
||||
CellUtil.cloneValue(multiKvs[j])));
|
||||
}
|
||||
}
|
||||
table.close();
|
||||
|
|
|
@ -407,20 +407,20 @@ public class TestMultipleTimestamps {
|
|||
String ctx = "rowIdx=" + rowIdx + "; colIdx=" + colIdx + "; ts=" + ts;
|
||||
|
||||
assertEquals("Row mismatch which checking: " + ctx,
|
||||
"row:"+ rowIdx, Bytes.toString(CellUtil.getRowArray(kv)));
|
||||
"row:"+ rowIdx, Bytes.toString(CellUtil.cloneRow(kv)));
|
||||
|
||||
assertEquals("ColumnFamily mismatch while checking: " + ctx,
|
||||
Bytes.toString(cf), Bytes.toString(CellUtil.getFamilyArray(kv)));
|
||||
Bytes.toString(cf), Bytes.toString(CellUtil.cloneFamily(kv)));
|
||||
|
||||
assertEquals("Column qualifier mismatch while checking: " + ctx,
|
||||
"column:" + colIdx,
|
||||
Bytes.toString(CellUtil.getQualifierArray(kv)));
|
||||
Bytes.toString(CellUtil.cloneQualifier(kv)));
|
||||
|
||||
assertEquals("Timestamp mismatch while checking: " + ctx,
|
||||
ts, kv.getTimestamp());
|
||||
|
||||
assertEquals("Value mismatch while checking: " + ctx,
|
||||
"value-version-" + ts, Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
"value-version-" + ts, Bytes.toString(CellUtil.cloneValue(kv)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -197,9 +197,9 @@ public class TestTimestampsFilter {
|
|||
|
||||
Result result = ht.get(g);
|
||||
for (Cell kv : result.listCells()) {
|
||||
System.out.println("found row " + Bytes.toString(CellUtil.getRowArray(kv)) +
|
||||
", column " + Bytes.toString(CellUtil.getQualifierArray(kv)) + ", value "
|
||||
+ Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
System.out.println("found row " + Bytes.toString(CellUtil.cloneRow(kv)) +
|
||||
", column " + Bytes.toString(CellUtil.cloneQualifier(kv)) + ", value "
|
||||
+ Bytes.toString(CellUtil.cloneValue(kv)));
|
||||
}
|
||||
|
||||
assertEquals(result.listCells().size(), 2);
|
||||
|
@ -292,20 +292,20 @@ public class TestTimestampsFilter {
|
|||
String ctx = "rowIdx=" + rowIdx + "; colIdx=" + colIdx + "; ts=" + ts;
|
||||
|
||||
assertEquals("Row mismatch which checking: " + ctx,
|
||||
"row:"+ rowIdx, Bytes.toString(CellUtil.getRowArray(kv)));
|
||||
"row:"+ rowIdx, Bytes.toString(CellUtil.cloneRow(kv)));
|
||||
|
||||
assertEquals("ColumnFamily mismatch while checking: " + ctx,
|
||||
Bytes.toString(cf), Bytes.toString(CellUtil.getFamilyArray(kv)));
|
||||
Bytes.toString(cf), Bytes.toString(CellUtil.cloneFamily(kv)));
|
||||
|
||||
assertEquals("Column qualifier mismatch while checking: " + ctx,
|
||||
"column:" + colIdx,
|
||||
Bytes.toString(CellUtil.getQualifierArray(kv)));
|
||||
Bytes.toString(CellUtil.cloneQualifier(kv)));
|
||||
|
||||
assertEquals("Timestamp mismatch while checking: " + ctx,
|
||||
ts, kv.getTimestamp());
|
||||
|
||||
assertEquals("Value mismatch while checking: " + ctx,
|
||||
"value-version-" + ts, Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
"value-version-" + ts, Bytes.toString(CellUtil.cloneValue(kv)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -347,7 +347,7 @@ public class TestRegionObserverInterface {
|
|||
do {
|
||||
hasMore = scanner.next(internalResults, limit);
|
||||
if (!internalResults.isEmpty()) {
|
||||
long row = Bytes.toLong(CellUtil.getValueArray(internalResults.get(0)));
|
||||
long row = Bytes.toLong(CellUtil.cloneValue(internalResults.get(0)));
|
||||
if (row % 2 == 0) {
|
||||
// return this row
|
||||
break;
|
||||
|
|
|
@ -336,7 +336,7 @@ public class TestRowProcessorEndpoint {
|
|||
scan.addColumn(FAM, COUNTER);
|
||||
doScan(region, scan, kvs);
|
||||
counter = kvs.size() == 0 ? 0 :
|
||||
Bytes.toInt(CellUtil.getValueArray(kvs.iterator().next()));
|
||||
Bytes.toInt(CellUtil.cloneValue(kvs.iterator().next()));
|
||||
|
||||
// Assert counter value
|
||||
assertEquals(expectedCounter, counter);
|
||||
|
@ -422,7 +422,7 @@ public class TestRowProcessorEndpoint {
|
|||
// Second scan to get friends of friends
|
||||
Scan scan = new Scan(row, row);
|
||||
for (Cell kv : kvs) {
|
||||
byte[] friends = CellUtil.getValueArray(kv);
|
||||
byte[] friends = CellUtil.cloneValue(kv);
|
||||
for (byte f : friends) {
|
||||
scan.addColumn(FAM, new byte[]{f});
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ public class TestRowProcessorEndpoint {
|
|||
// Collect result
|
||||
result.clear();
|
||||
for (Cell kv : kvs) {
|
||||
for (byte b : CellUtil.getValueArray(kv)) {
|
||||
for (byte b : CellUtil.cloneValue(kv)) {
|
||||
result.add((char)b + "");
|
||||
}
|
||||
}
|
||||
|
@ -526,11 +526,11 @@ public class TestRowProcessorEndpoint {
|
|||
for (Cell kv : kvs.get(i)) {
|
||||
// Delete from the current row and add to the other row
|
||||
KeyValue kvDelete =
|
||||
new KeyValue(rows[i], CellUtil.getFamilyArray(kv), CellUtil.getQualifierArray(kv),
|
||||
new KeyValue(rows[i], CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv),
|
||||
kv.getTimestamp(), KeyValue.Type.Delete);
|
||||
KeyValue kvAdd =
|
||||
new KeyValue(rows[1 - i], CellUtil.getFamilyArray(kv), CellUtil.getQualifierArray(kv),
|
||||
now, CellUtil.getValueArray(kv));
|
||||
new KeyValue(rows[1 - i], CellUtil.cloneFamily(kv), CellUtil.cloneQualifier(kv),
|
||||
now, CellUtil.cloneValue(kv));
|
||||
mutations.add(kvDelete);
|
||||
walEdit.add(kvDelete);
|
||||
mutations.add(kvAdd);
|
||||
|
@ -636,8 +636,8 @@ public class TestRowProcessorEndpoint {
|
|||
out.append("[");
|
||||
if (kvs != null) {
|
||||
for (Cell kv : kvs) {
|
||||
byte[] col = CellUtil.getQualifierArray(kv);
|
||||
byte[] val = CellUtil.getValueArray(kv);
|
||||
byte[] col = CellUtil.cloneQualifier(kv);
|
||||
byte[] val = CellUtil.cloneValue(kv);
|
||||
if (Bytes.equals(col, COUNTER)) {
|
||||
out.append(Bytes.toStringBinary(col) + ":" +
|
||||
Bytes.toInt(val) + " ");
|
||||
|
|
|
@ -284,7 +284,7 @@ public class TestFilter {
|
|||
scanner.next(results);
|
||||
for (Cell keyValue : results) {
|
||||
assertFalse("Cannot rewind back to a value less than previous reseek.",
|
||||
Bytes.toString(CellUtil.getRowArray(keyValue)).contains("testRowOne"));
|
||||
Bytes.toString(CellUtil.cloneRow(keyValue)).contains("testRowOne"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ public class TestFilter {
|
|||
while (true) {
|
||||
ArrayList<Cell> values = new ArrayList<Cell>();
|
||||
boolean isMoreResults = scanner.next(values);
|
||||
if (!isMoreResults || !Bytes.toString(CellUtil.getRowArray(values.get(0))).startsWith(prefix)) {
|
||||
if (!isMoreResults || !Bytes.toString(CellUtil.cloneRow(values.get(0))).startsWith(prefix)) {
|
||||
assertTrue("The WhileMatchFilter should now filter all remaining", filter.filterAllRemaining());
|
||||
}
|
||||
if (!isMoreResults) {
|
||||
|
@ -1475,9 +1475,9 @@ public class TestFilter {
|
|||
assertEquals("Value in result is not SIZEOF_INT",
|
||||
kv.getValueLength(), Bytes.SIZEOF_INT);
|
||||
LOG.info("idx = " + idx + ", len=" + kvs[idx].getValueLength()
|
||||
+ ", actual=" + Bytes.toInt(CellUtil.getValueArray(kv)));
|
||||
+ ", actual=" + Bytes.toInt(CellUtil.cloneValue(kv)));
|
||||
assertEquals("Scan value should be the length of the actual value. ",
|
||||
kvs[idx].getValueLength(), Bytes.toInt(CellUtil.getValueArray(kv)) );
|
||||
kvs[idx].getValueLength(), Bytes.toInt(CellUtil.cloneValue(kv)) );
|
||||
LOG.info("good");
|
||||
} else {
|
||||
assertEquals("Value in result is not empty", kv.getValueLength(), 0);
|
||||
|
@ -1787,7 +1787,7 @@ public class TestFilter {
|
|||
for (boolean done = true; done; i++) {
|
||||
done = scanner.next(results);
|
||||
assertTrue(CellUtil.matchingRow(results.get(0), Bytes.toBytes("row" + i)));
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(results.get(0))), i%2);
|
||||
assertEquals(Bytes.toInt(CellUtil.cloneValue(results.get(0))), i%2);
|
||||
results.clear();
|
||||
}
|
||||
// 2. got rows <= "row4" and S=
|
||||
|
@ -1805,7 +1805,7 @@ public class TestFilter {
|
|||
for (i=0; i<=4; i+=2) {
|
||||
scanner.next(results);
|
||||
assertTrue(CellUtil.matchingRow(results.get(0), Bytes.toBytes("row" + i)));
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(results.get(0))), i%2);
|
||||
assertEquals(Bytes.toInt(CellUtil.cloneValue(results.get(0))), i%2);
|
||||
results.clear();
|
||||
}
|
||||
assertFalse(scanner.next(results));
|
||||
|
@ -1821,13 +1821,13 @@ public class TestFilter {
|
|||
for (i=0; i<=4; i+=2) {
|
||||
scanner.next(results);
|
||||
assertTrue(CellUtil.matchingRow(results.get(0), Bytes.toBytes("row" + i)));
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(results.get(0))), i%2);
|
||||
assertEquals(Bytes.toInt(CellUtil.cloneValue(results.get(0))), i%2);
|
||||
results.clear();
|
||||
}
|
||||
for (i=5; i<=9; i++) {
|
||||
scanner.next(results);
|
||||
assertTrue(CellUtil.matchingRow(results.get(0), Bytes.toBytes("row" + i)));
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(results.get(0))), i%2);
|
||||
assertEquals(Bytes.toInt(CellUtil.cloneValue(results.get(0))), i%2);
|
||||
results.clear();
|
||||
}
|
||||
assertFalse(scanner.next(results));
|
||||
|
@ -1842,13 +1842,13 @@ public class TestFilter {
|
|||
for (i=0; i<=4; i+=2) {
|
||||
scanner.next(results);
|
||||
assertTrue(CellUtil.matchingRow(results.get(0), Bytes.toBytes("row" + i)));
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(results.get(0))), i%2);
|
||||
assertEquals(Bytes.toInt(CellUtil.cloneValue(results.get(0))), i%2);
|
||||
results.clear();
|
||||
}
|
||||
for (i=5; i<=9; i++) {
|
||||
scanner.next(results);
|
||||
assertTrue(CellUtil.matchingRow(results.get(0), Bytes.toBytes("row" + i)));
|
||||
assertEquals(Bytes.toInt(CellUtil.getValueArray(results.get(0))), i%2);
|
||||
assertEquals(Bytes.toInt(CellUtil.cloneValue(results.get(0))), i%2);
|
||||
results.clear();
|
||||
}
|
||||
assertFalse(scanner.next(results));
|
||||
|
|
|
@ -92,7 +92,7 @@ public class TestFilterWrapper {
|
|||
for (Cell kv : result.listCells()) {
|
||||
LOG.debug(kv_number + ". kv: " + kv);
|
||||
kv_number++;
|
||||
assertEquals("Returned row is not correct", new String(CellUtil.getRowArray(kv)),
|
||||
assertEquals("Returned row is not correct", new String(CellUtil.cloneRow(kv)),
|
||||
"row" + ( row_number + 1 ));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,8 +164,8 @@ public class TestFuzzyRowAndColumnRangeFilter {
|
|||
long timeBeforeScan = System.currentTimeMillis();
|
||||
while ((result = scanner.next()) != null) {
|
||||
for (Cell kv : result.listCells()) {
|
||||
LOG.info("Got rk: " + Bytes.toStringBinary(CellUtil.getRowArray(kv)) + " cq: "
|
||||
+ Bytes.toStringBinary(CellUtil.getQualifierArray(kv)));
|
||||
LOG.info("Got rk: " + Bytes.toStringBinary(CellUtil.cloneRow(kv)) + " cq: "
|
||||
+ Bytes.toStringBinary(CellUtil.cloneQualifier(kv)));
|
||||
results.add(kv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,10 +215,10 @@ public class TestTableMapReduce {
|
|||
int count = 0;
|
||||
for(Cell kv : r.listCells()) {
|
||||
if (count == 0) {
|
||||
firstValue = CellUtil.getValueArray(kv);
|
||||
firstValue = CellUtil.cloneValue(kv);
|
||||
}
|
||||
if (count == 1) {
|
||||
secondValue = CellUtil.getValueArray(kv);;
|
||||
secondValue = CellUtil.cloneValue(kv);;
|
||||
}
|
||||
count++;
|
||||
if (count == 2) {
|
||||
|
|
|
@ -431,7 +431,7 @@ public class TestHFileOutputFormat {
|
|||
Cell first = res.rawCells()[0];
|
||||
for (Cell kv : res.rawCells()) {
|
||||
assertTrue(CellUtil.matchingRow(first, kv));
|
||||
assertTrue(Bytes.equals(CellUtil.getValueArray(first), CellUtil.getValueArray(kv)));
|
||||
assertTrue(Bytes.equals(CellUtil.cloneValue(first), CellUtil.cloneValue(kv)));
|
||||
}
|
||||
}
|
||||
results.close();
|
||||
|
|
|
@ -215,9 +215,9 @@ public class TestMultithreadedTableMapper {
|
|||
int count = 0;
|
||||
for(Cell kv : r.listCells()) {
|
||||
if (count == 0) {
|
||||
firstValue = CellUtil.getValueArray(kv);
|
||||
firstValue = CellUtil.cloneValue(kv);
|
||||
}else if (count == 1) {
|
||||
secondValue = CellUtil.getValueArray(kv);
|
||||
secondValue = CellUtil.cloneValue(kv);
|
||||
}else if (count == 2) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -228,10 +228,10 @@ public class TestTableMapReduce {
|
|||
int count = 0;
|
||||
for(Cell kv : r.listCells()) {
|
||||
if (count == 0) {
|
||||
firstValue = CellUtil.getValueArray(kv);
|
||||
firstValue = CellUtil.cloneValue(kv);
|
||||
}
|
||||
if (count == 1) {
|
||||
secondValue = CellUtil.getValueArray(kv);
|
||||
secondValue = CellUtil.cloneValue(kv);
|
||||
}
|
||||
count++;
|
||||
if (count == 2) {
|
||||
|
|
|
@ -197,11 +197,11 @@ public class TestTimeRangeMapRed {
|
|||
ResultScanner scanner = table.getScanner(scan);
|
||||
for (Result r: scanner) {
|
||||
for (Cell kv : r.listCells()) {
|
||||
log.debug(Bytes.toString(r.getRow()) + "\t" + Bytes.toString(CellUtil.getFamilyArray(kv))
|
||||
+ "\t" + Bytes.toString(CellUtil.getQualifierArray(kv))
|
||||
+ "\t" + kv.getTimestamp() + "\t" + Bytes.toBoolean(CellUtil.getValueArray(kv)));
|
||||
log.debug(Bytes.toString(r.getRow()) + "\t" + Bytes.toString(CellUtil.cloneFamily(kv))
|
||||
+ "\t" + Bytes.toString(CellUtil.cloneQualifier(kv))
|
||||
+ "\t" + kv.getTimestamp() + "\t" + Bytes.toBoolean(CellUtil.cloneValue(kv)));
|
||||
org.junit.Assert.assertEquals(TIMESTAMP.get(kv.getTimestamp()),
|
||||
(Boolean)Bytes.toBoolean(CellUtil.getValueArray(kv)));
|
||||
(Boolean)Bytes.toBoolean(CellUtil.cloneValue(kv)));
|
||||
}
|
||||
}
|
||||
scanner.close();
|
||||
|
|
|
@ -175,7 +175,7 @@ public class TestAtomicOperation {
|
|||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.rawCells()[0];
|
||||
long r = Bytes.toLong(CellUtil.getValueArray(kv));
|
||||
long r = Bytes.toLong(CellUtil.cloneValue(kv));
|
||||
assertEquals(amount, r);
|
||||
}
|
||||
|
||||
|
@ -546,7 +546,7 @@ public class TestAtomicOperation {
|
|||
List<Cell> results = new ArrayList<Cell>();
|
||||
scanner.next(results, 2);
|
||||
for (Cell keyValue : results) {
|
||||
assertEquals("50",Bytes.toString(CellUtil.getValueArray(keyValue)));
|
||||
assertEquals("50",Bytes.toString(CellUtil.cloneValue(keyValue)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class TestCompaction extends HBaseTestCase {
|
|||
do {
|
||||
List<Cell> results = new ArrayList<Cell>();
|
||||
boolean result = s.next(results);
|
||||
r.delete(new Delete(CellUtil.getRowArray(results.get(0))));
|
||||
r.delete(new Delete(CellUtil.cloneRow(results.get(0))));
|
||||
if (!result) break;
|
||||
} while(true);
|
||||
s.close();
|
||||
|
|
|
@ -116,7 +116,7 @@ public class TestGetClosestAtOrBefore extends HBaseTestCase {
|
|||
try {
|
||||
List<Cell> keys = new ArrayList<Cell>();
|
||||
while (s.next(keys)) {
|
||||
mr.delete(new Delete(CellUtil.getRowArray(keys.get(0))));
|
||||
mr.delete(new Delete(CellUtil.cloneRow(keys.get(0))));
|
||||
keys.clear();
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -249,7 +249,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
List<Cell> results = new ArrayList<Cell>();
|
||||
scanner1.next(results);
|
||||
Cell keyValue = results.get(0);
|
||||
Assert.assertTrue(Bytes.compareTo(CellUtil.getRowArray(keyValue), Bytes.toBytes("r2")) == 0);
|
||||
Assert.assertTrue(Bytes.compareTo(CellUtil.cloneRow(keyValue), Bytes.toBytes("r2")) == 0);
|
||||
scanner1.close();
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
for (long i = minSeqId; i <= maxSeqId; i += 10) {
|
||||
List<Cell> kvs = result.getColumn(family, Bytes.toBytes(i));
|
||||
assertEquals(1, kvs.size());
|
||||
assertEquals(Bytes.toBytes(i), CellUtil.getValueArray(kvs.get(0)));
|
||||
assertEquals(Bytes.toBytes(i), CellUtil.cloneValue(kvs.get(0)));
|
||||
}
|
||||
} finally {
|
||||
HRegion.closeHRegion(this.region);
|
||||
|
@ -352,7 +352,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
assertEquals(0, kvs.size());
|
||||
} else {
|
||||
assertEquals(1, kvs.size());
|
||||
assertEquals(Bytes.toBytes(i), CellUtil.getValueArray(kvs.get(0)));
|
||||
assertEquals(Bytes.toBytes(i), CellUtil.cloneValue(kvs.get(0)));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
@ -678,7 +678,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
count++;
|
||||
else
|
||||
break;
|
||||
Delete delete = new Delete(CellUtil.getRowArray(results.get(0)));
|
||||
Delete delete = new Delete(CellUtil.cloneRow(results.get(0)));
|
||||
delete.deleteColumn(Bytes.toBytes("trans-tags"), Bytes.toBytes("qual2"));
|
||||
r.delete(delete);
|
||||
results.clear();
|
||||
|
@ -696,7 +696,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
if (results != null && !results.isEmpty()) numberOfResults++;
|
||||
else break;
|
||||
for (Cell kv: results) {
|
||||
System.out.println("kv=" + kv.toString() + ", " + Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
System.out.println("kv=" + kv.toString() + ", " + Bytes.toString(CellUtil.cloneValue(kv)));
|
||||
}
|
||||
results.clear();
|
||||
} while(more);
|
||||
|
@ -1542,10 +1542,10 @@ public class TestHRegion extends HBaseTestCase {
|
|||
assertEquals(1, results.size());
|
||||
Cell kv = results.get(0);
|
||||
|
||||
assertByteEquals(value2, CellUtil.getValueArray(kv));
|
||||
assertByteEquals(fam1, CellUtil.getFamilyArray(kv));
|
||||
assertByteEquals(qual1, CellUtil.getQualifierArray(kv));
|
||||
assertByteEquals(row, CellUtil.getRowArray(kv));
|
||||
assertByteEquals(value2, CellUtil.cloneValue(kv));
|
||||
assertByteEquals(fam1, CellUtil.cloneFamily(kv));
|
||||
assertByteEquals(qual1, CellUtil.cloneQualifier(kv));
|
||||
assertByteEquals(row, CellUtil.cloneRow(kv));
|
||||
} finally {
|
||||
HRegion.closeHRegion(this.region);
|
||||
this.region = null;
|
||||
|
@ -2367,7 +2367,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.rawCells()[0];
|
||||
long r = Bytes.toLong(CellUtil.getValueArray(kv));
|
||||
long r = Bytes.toLong(CellUtil.cloneValue(kv));
|
||||
assertEquals(amount, r);
|
||||
}
|
||||
|
||||
|
@ -2382,7 +2382,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.rawCells()[0];
|
||||
int r = Bytes.toInt(CellUtil.getValueArray(kv));
|
||||
int r = Bytes.toInt(CellUtil.cloneValue(kv));
|
||||
assertEquals(amount, r);
|
||||
}
|
||||
|
||||
|
@ -3128,16 +3128,16 @@ public class TestHRegion extends HBaseTestCase {
|
|||
Cell previousKV = null;
|
||||
|
||||
for (Cell kv : result.rawCells()) {
|
||||
byte[] thisValue = CellUtil.getValueArray(kv);
|
||||
byte[] thisValue = CellUtil.cloneValue(kv);
|
||||
if (previousKV != null) {
|
||||
if (Bytes.compareTo(CellUtil.getValueArray(previousKV), thisValue) != 0) {
|
||||
if (Bytes.compareTo(CellUtil.cloneValue(previousKV), thisValue) != 0) {
|
||||
LOG.warn("These two KV should have the same value." +
|
||||
" Previous KV:" +
|
||||
previousKV + "(memStoreTS:" + previousKV.getMvccVersion() + ")" +
|
||||
", New KV: " +
|
||||
kv + "(memStoreTS:" + kv.getMvccVersion() + ")"
|
||||
);
|
||||
assertEquals(0, Bytes.compareTo(CellUtil.getValueArray(previousKV), thisValue));
|
||||
assertEquals(0, Bytes.compareTo(CellUtil.cloneValue(previousKV), thisValue));
|
||||
}
|
||||
}
|
||||
previousKV = kv;
|
||||
|
@ -3742,7 +3742,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
res = this.region.get(get);
|
||||
kvs = res.getColumn(family, qualifier);
|
||||
assertEquals(1, kvs.size());
|
||||
assertEquals(Bytes.toBytes("value0"), CellUtil.getValueArray(kvs.get(0)));
|
||||
assertEquals(Bytes.toBytes("value0"), CellUtil.cloneValue(kvs.get(0)));
|
||||
|
||||
region.flushcache();
|
||||
get = new Get(row);
|
||||
|
@ -3751,7 +3751,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
res = this.region.get(get);
|
||||
kvs = res.getColumn(family, qualifier);
|
||||
assertEquals(1, kvs.size());
|
||||
assertEquals(Bytes.toBytes("value0"), CellUtil.getValueArray(kvs.get(0)));
|
||||
assertEquals(Bytes.toBytes("value0"), CellUtil.cloneValue(kvs.get(0)));
|
||||
|
||||
put = new Put(row);
|
||||
value = Bytes.toBytes("value1");
|
||||
|
@ -3763,7 +3763,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
res = this.region.get(get);
|
||||
kvs = res.getColumn(family, qualifier);
|
||||
assertEquals(1, kvs.size());
|
||||
assertEquals(Bytes.toBytes("value1"), CellUtil.getValueArray(kvs.get(0)));
|
||||
assertEquals(Bytes.toBytes("value1"), CellUtil.cloneValue(kvs.get(0)));
|
||||
|
||||
region.flushcache();
|
||||
get = new Get(row);
|
||||
|
@ -3772,7 +3772,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
res = this.region.get(get);
|
||||
kvs = res.getColumn(family, qualifier);
|
||||
assertEquals(1, kvs.size());
|
||||
assertEquals(Bytes.toBytes("value1"), CellUtil.getValueArray(kvs.get(0)));
|
||||
assertEquals(Bytes.toBytes("value1"), CellUtil.cloneValue(kvs.get(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -3915,7 +3915,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
Get get = new Get(k).addFamily(family).setMaxVersions();
|
||||
Cell [] results = r.get(get).rawCells();
|
||||
for (int j = 0; j < results.length; j++) {
|
||||
byte [] tmp = CellUtil.getValueArray(results[j]);
|
||||
byte [] tmp = CellUtil.cloneValue(results[j]);
|
||||
// Row should be equal to value every time.
|
||||
assertTrue(Bytes.equals(k, tmp));
|
||||
}
|
||||
|
@ -3940,7 +3940,7 @@ public class TestHRegion extends HBaseTestCase {
|
|||
boolean first = true;
|
||||
OUTER_LOOP: while(s.next(curVals)) {
|
||||
for (Cell kv: curVals) {
|
||||
byte [] val = CellUtil.getValueArray(kv);
|
||||
byte [] val = CellUtil.cloneValue(kv);
|
||||
byte [] curval = val;
|
||||
if (first) {
|
||||
first = false;
|
||||
|
@ -4069,15 +4069,15 @@ public class TestHRegion extends HBaseTestCase {
|
|||
int rowIdx, int colIdx, long ts) {
|
||||
String ctx = "rowIdx=" + rowIdx + "; colIdx=" + colIdx + "; ts=" + ts;
|
||||
assertEquals("Row mismatch which checking: " + ctx,
|
||||
"row:"+ rowIdx, Bytes.toString(CellUtil.getRowArray(kv)));
|
||||
"row:"+ rowIdx, Bytes.toString(CellUtil.cloneRow(kv)));
|
||||
assertEquals("ColumnFamily mismatch while checking: " + ctx,
|
||||
Bytes.toString(cf), Bytes.toString(CellUtil.getFamilyArray(kv)));
|
||||
Bytes.toString(cf), Bytes.toString(CellUtil.cloneFamily(kv)));
|
||||
assertEquals("Column qualifier mismatch while checking: " + ctx,
|
||||
"column:" + colIdx, Bytes.toString(CellUtil.getQualifierArray(kv)));
|
||||
"column:" + colIdx, Bytes.toString(CellUtil.cloneQualifier(kv)));
|
||||
assertEquals("Timestamp mismatch while checking: " + ctx,
|
||||
ts, kv.getTimestamp());
|
||||
assertEquals("Value mismatch while checking: " + ctx,
|
||||
"value-version-" + ts, Bytes.toString(CellUtil.getValueArray(kv)));
|
||||
"value-version-" + ts, Bytes.toString(CellUtil.cloneValue(kv)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -339,11 +339,11 @@ public class TestKeepDeletes {
|
|||
scan.next(kvs);
|
||||
assertEquals(8, kvs.size());
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs.get(0)));
|
||||
assertArrayEquals(CellUtil.getValueArray(kvs.get(1)), T3);
|
||||
assertArrayEquals(CellUtil.cloneValue(kvs.get(1)), T3);
|
||||
assertTrue(CellUtil.isDelete(kvs.get(2)));
|
||||
assertTrue(CellUtil.isDelete(kvs.get(3))); // .isDeleteType());
|
||||
assertArrayEquals(CellUtil.getValueArray(kvs.get(4)), T2);
|
||||
assertArrayEquals(CellUtil.getValueArray(kvs.get(5)), T1);
|
||||
assertArrayEquals(CellUtil.cloneValue(kvs.get(4)), T2);
|
||||
assertArrayEquals(CellUtil.cloneValue(kvs.get(5)), T1);
|
||||
// we have 3 CFs, so there are two more delete markers
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs.get(6)));
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs.get(7)));
|
||||
|
@ -369,7 +369,7 @@ public class TestKeepDeletes {
|
|||
scan.next(kvs);
|
||||
assertEquals(4, kvs.size());
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs.get(0)));
|
||||
assertArrayEquals(CellUtil.getValueArray(kvs.get(1)), T1);
|
||||
assertArrayEquals(CellUtil.cloneValue(kvs.get(1)), T1);
|
||||
// we have 3 CFs
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs.get(2)));
|
||||
assertTrue(CellUtil.isDeleteFamily(kvs.get(3)));
|
||||
|
@ -383,7 +383,7 @@ public class TestKeepDeletes {
|
|||
kvs = new ArrayList<Cell>();
|
||||
scan.next(kvs);
|
||||
assertEquals(2, kvs.size());
|
||||
assertArrayEquals(CellUtil.getValueArray(kvs.get(0)), T3);
|
||||
assertArrayEquals(CellUtil.cloneValue(kvs.get(0)), T3);
|
||||
assertTrue(CellUtil.isDelete(kvs.get(1)));
|
||||
|
||||
|
||||
|
@ -835,7 +835,7 @@ public class TestKeepDeletes {
|
|||
List<Cell> kvs = r.getColumn(fam, col);
|
||||
assertEquals(kvs.size(), vals.length);
|
||||
for (int i=0;i<vals.length;i++) {
|
||||
assertArrayEquals(CellUtil.getValueArray(kvs.get(i)), vals[i]);
|
||||
assertArrayEquals(CellUtil.cloneValue(kvs.get(i)), vals[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -288,8 +288,8 @@ public class TestMultiColumnScanner {
|
|||
}
|
||||
|
||||
private static String getRowQualStr(Cell kv) {
|
||||
String rowStr = Bytes.toString(CellUtil.getRowArray(kv));
|
||||
String qualStr = Bytes.toString(CellUtil.getQualifierArray(kv));
|
||||
String rowStr = Bytes.toString(CellUtil.cloneRow(kv));
|
||||
String qualStr = Bytes.toString(CellUtil.cloneQualifier(kv));
|
||||
return rowStr + "_" + qualStr;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ public class TestParallelPut extends HBaseTestCase {
|
|||
assertEquals(1, result.size());
|
||||
|
||||
Cell kv = result.rawCells()[0];
|
||||
byte[] r = CellUtil.getValueArray(kv);
|
||||
byte[] r = CellUtil.cloneValue(kv);
|
||||
assertTrue(Bytes.compareTo(r, value) == 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ public class TestResettingCounters {
|
|||
for (int i=0;i<kvs.length;i++) {
|
||||
System.out.println(kvs[i].toString());
|
||||
assertTrue(CellUtil.matchingQualifier(kvs[i], qualifiers[i]));
|
||||
assertEquals(6, Bytes.toLong(CellUtil.getValueArray(kvs[i])));
|
||||
assertEquals(6, Bytes.toLong(CellUtil.cloneValue(kvs[i])));
|
||||
}
|
||||
} finally {
|
||||
HRegion.closeHRegion(region);
|
||||
|
|
|
@ -170,7 +170,7 @@ public class TestScanWithBloomError {
|
|||
|
||||
List<Integer> actualIds = new ArrayList<Integer>();
|
||||
for (Cell kv : allResults) {
|
||||
String qual = Bytes.toString(CellUtil.getQualifierArray(kv));
|
||||
String qual = Bytes.toString(CellUtil.cloneQualifier(kv));
|
||||
assertTrue(qual.startsWith(QUALIFIER_PREFIX));
|
||||
actualIds.add(Integer.valueOf(qual.substring(
|
||||
QUALIFIER_PREFIX.length())));
|
||||
|
|
|
@ -158,7 +158,7 @@ public class TestScanner {
|
|||
}
|
||||
count++;
|
||||
}
|
||||
assertTrue(Bytes.BYTES_COMPARATOR.compare(stoprow, CellUtil.getRowArray(kv)) > 0);
|
||||
assertTrue(Bytes.BYTES_COMPARATOR.compare(stoprow, CellUtil.cloneRow(kv)) > 0);
|
||||
// We got something back.
|
||||
assertTrue(count > 10);
|
||||
s.close();
|
||||
|
@ -175,8 +175,8 @@ public class TestScanner {
|
|||
while (hasMore) {
|
||||
hasMore = s.next(results);
|
||||
for (Cell kv : results) {
|
||||
assertEquals((byte)'a', CellUtil.getRowArray(kv)[0]);
|
||||
assertEquals((byte)'b', CellUtil.getRowArray(kv)[1]);
|
||||
assertEquals((byte)'a', CellUtil.cloneRow(kv)[0]);
|
||||
assertEquals((byte)'b', CellUtil.cloneRow(kv)[1]);
|
||||
}
|
||||
results.clear();
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ public class TestScanner {
|
|||
while (hasMore) {
|
||||
hasMore = s.next(results);
|
||||
for (Cell kv : results) {
|
||||
assertTrue(Bytes.compareTo(CellUtil.getRowArray(kv), stopRow) <= 0);
|
||||
assertTrue(Bytes.compareTo(CellUtil.cloneRow(kv), stopRow) <= 0);
|
||||
}
|
||||
results.clear();
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ public class TestScanner {
|
|||
while (scanner.next(results)) {
|
||||
assertTrue(hasColumn(results, HConstants.CATALOG_FAMILY,
|
||||
HConstants.REGIONINFO_QUALIFIER));
|
||||
byte [] val = CellUtil.getValueArray(getColumn(results, HConstants.CATALOG_FAMILY,
|
||||
byte [] val = CellUtil.cloneValue(getColumn(results, HConstants.CATALOG_FAMILY,
|
||||
HConstants.REGIONINFO_QUALIFIER));
|
||||
validateRegionInfo(val);
|
||||
if(validateStartcode) {
|
||||
|
@ -409,7 +409,7 @@ public class TestScanner {
|
|||
if(serverName != null) {
|
||||
assertTrue(hasColumn(results, HConstants.CATALOG_FAMILY,
|
||||
HConstants.SERVER_QUALIFIER));
|
||||
val = CellUtil.getValueArray(getColumn(results, HConstants.CATALOG_FAMILY,
|
||||
val = CellUtil.cloneValue(getColumn(results, HConstants.CATALOG_FAMILY,
|
||||
HConstants.SERVER_QUALIFIER));
|
||||
assertNotNull(val);
|
||||
assertFalse(val.length == 0);
|
||||
|
|
|
@ -273,14 +273,14 @@ public class TestSeekOptimizations {
|
|||
}
|
||||
|
||||
if (!qualSet.isEmpty() && (!CellUtil.matchingFamily(kv, FAMILY_BYTES)
|
||||
|| !qualSet.contains(Bytes.toString(CellUtil.getQualifierArray(kv))))) {
|
||||
|| !qualSet.contains(Bytes.toString(CellUtil.cloneQualifier(kv))))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String rowColStr =
|
||||
Bytes.toStringBinary(CellUtil.getRowArray(kv)) + "/"
|
||||
+ Bytes.toStringBinary(CellUtil.getFamilyArray(kv)) + ":"
|
||||
+ Bytes.toStringBinary(CellUtil.getQualifierArray(kv));
|
||||
Bytes.toStringBinary(CellUtil.cloneRow(kv)) + "/"
|
||||
+ Bytes.toStringBinary(CellUtil.cloneFamily(kv)) + ":"
|
||||
+ Bytes.toStringBinary(CellUtil.cloneQualifier(kv));
|
||||
final Integer curNumVer = verCount.get(rowColStr);
|
||||
final int newNumVer = curNumVer != null ? (curNumVer + 1) : 1;
|
||||
if (newNumVer <= maxVersions) {
|
||||
|
|
|
@ -496,8 +496,8 @@ public class TestStore extends TestCase {
|
|||
|
||||
assertTrue(ts1 > ts2);
|
||||
|
||||
assertEquals(newValue, Bytes.toLong(CellUtil.getValueArray(results.get(0))));
|
||||
assertEquals(oldValue, Bytes.toLong(CellUtil.getValueArray(results.get(1))));
|
||||
assertEquals(newValue, Bytes.toLong(CellUtil.cloneValue(results.get(0))));
|
||||
assertEquals(oldValue, Bytes.toLong(CellUtil.cloneValue(results.get(1))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -611,8 +611,8 @@ public class TestStore extends TestCase {
|
|||
long ts2 = results.get(1).getTimestamp();
|
||||
|
||||
assertTrue(ts1 > ts2);
|
||||
assertEquals(newValue, Bytes.toLong(CellUtil.getValueArray(results.get(0))));
|
||||
assertEquals(oldValue, Bytes.toLong(CellUtil.getValueArray(results.get(1))));
|
||||
assertEquals(newValue, Bytes.toLong(CellUtil.cloneValue(results.get(0))));
|
||||
assertEquals(oldValue, Bytes.toLong(CellUtil.cloneValue(results.get(1))));
|
||||
|
||||
mee.setValue(2); // time goes up slightly
|
||||
newValue += 1;
|
||||
|
@ -625,8 +625,8 @@ public class TestStore extends TestCase {
|
|||
ts2 = results.get(1).getTimestamp();
|
||||
|
||||
assertTrue(ts1 > ts2);
|
||||
assertEquals(newValue, Bytes.toLong(CellUtil.getValueArray(results.get(0))));
|
||||
assertEquals(oldValue, Bytes.toLong(CellUtil.getValueArray(results.get(1))));
|
||||
assertEquals(newValue, Bytes.toLong(CellUtil.cloneValue(results.get(0))));
|
||||
assertEquals(oldValue, Bytes.toLong(CellUtil.cloneValue(results.get(1))));
|
||||
}
|
||||
|
||||
public void testHandleErrorsInFlush() throws Exception {
|
||||
|
|
|
@ -112,9 +112,9 @@ public class TestWideScanner extends HBaseTestCase {
|
|||
|
||||
if (results.size() > 0) {
|
||||
// assert that all results are from the same row
|
||||
byte[] row = CellUtil.getRowArray(results.get(0));
|
||||
byte[] row = CellUtil.cloneRow(results.get(0));
|
||||
for (Cell kv: results) {
|
||||
assertTrue(Bytes.equals(row, CellUtil.getRowArray(kv)));
|
||||
assertTrue(Bytes.equals(row, CellUtil.cloneRow(kv)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,9 +140,9 @@ public class TestReplicationSmallTests extends TestReplicationBase {
|
|||
LOG.info("Rows not available");
|
||||
Thread.sleep(SLEEP_TIME);
|
||||
} else {
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[0]), v3);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[1]), v2);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[2]), v1);
|
||||
assertArrayEquals(CellUtil.cloneValue(res.rawCells()[0]), v3);
|
||||
assertArrayEquals(CellUtil.cloneValue(res.rawCells()[1]), v2);
|
||||
assertArrayEquals(CellUtil.cloneValue(res.rawCells()[2]), v1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -162,8 +162,8 @@ public class TestReplicationSmallTests extends TestReplicationBase {
|
|||
LOG.info("Version not deleted");
|
||||
Thread.sleep(SLEEP_TIME);
|
||||
} else {
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[0]), v3);
|
||||
assertArrayEquals(CellUtil.getValueArray(res.rawCells()[1]), v2);
|
||||
assertArrayEquals(CellUtil.cloneValue(res.rawCells()[0]), v3);
|
||||
assertArrayEquals(CellUtil.cloneValue(res.rawCells()[1]), v2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -463,8 +463,8 @@ public class TestReplicationSmallTests extends TestReplicationBase {
|
|||
for (Result result : rs) {
|
||||
put = new Put(result.getRow());
|
||||
Cell firstVal = result.rawCells()[0];
|
||||
put.add(CellUtil.getFamilyArray(firstVal),
|
||||
CellUtil.getQualifierArray(firstVal), Bytes.toBytes("diff data"));
|
||||
put.add(CellUtil.cloneFamily(firstVal),
|
||||
CellUtil.cloneQualifier(firstVal), Bytes.toBytes("diff data"));
|
||||
htable2.put(put);
|
||||
}
|
||||
Delete delete = new Delete(put.getRow());
|
||||
|
|
|
@ -181,7 +181,7 @@ public class MultiThreadedUpdater extends MultiThreadedWriterBase {
|
|||
byte[] checkedValue = HConstants.EMPTY_BYTE_ARRAY;
|
||||
if (hashCode % 2 == 0) {
|
||||
Cell kv = result.getColumnLatest(cf, column);
|
||||
checkedValue = kv != null ? CellUtil.getValueArray(kv) : null;
|
||||
checkedValue = kv != null ? CellUtil.cloneValue(kv) : null;
|
||||
Preconditions.checkNotNull(checkedValue,
|
||||
"Column value to be checked should not be null");
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ public class TestMergeTool extends HBaseTestCase {
|
|||
get.addFamily(FAMILY);
|
||||
Result result = merged.get(get);
|
||||
assertEquals(1, result.size());
|
||||
byte [] bytes = CellUtil.getValueArray(result.rawCells()[0]);
|
||||
byte [] bytes = CellUtil.cloneValue(result.rawCells()[0]);
|
||||
assertNotNull(Bytes.toStringBinary(rows[i][j]), bytes);
|
||||
assertTrue(Bytes.equals(bytes, rows[i][j]));
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public class TestMergeTool extends HBaseTestCase {
|
|||
Get get = new Get(rows[i][j]);
|
||||
get.addFamily(FAMILY);
|
||||
Result result = regions[i].get(get);
|
||||
byte [] bytes = CellUtil.getValueArray(result.rawCells()[0]);
|
||||
byte [] bytes = CellUtil.cloneValue(result.rawCells()[0]);
|
||||
assertNotNull(bytes);
|
||||
assertTrue(Bytes.equals(bytes, rows[i][j]));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue