HBASE-18344 Introduce Append.addColumn as a replacement for Append.add

Signed-off-by: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
Jan Hentschel 2017-07-09 12:11:31 +02:00 committed by Chia-Ping Tsai
parent 9daac09f6e
commit 97b649eb93
26 changed files with 70 additions and 56 deletions

View File

@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.util.Bytes;
* <p> * <p>
* To append to a set of columns of a row, instantiate an Append object with the * To append to a set of columns of a row, instantiate an Append object with the
* row to append to. At least one column to append must be specified using the * row to append to. At least one column to append must be specified using the
* {@link #add(byte[], byte[], byte[])} method. * {@link #addColumn(byte[], byte[], byte[])} method.
*/ */
@InterfaceAudience.Public @InterfaceAudience.Public
public class Append extends Mutation { public class Append extends Mutation {
@ -104,8 +104,22 @@ public class Append extends Mutation {
* @param qualifier column qualifier * @param qualifier column qualifier
* @param value value to append to specified column * @param value value to append to specified column
* @return this * @return this
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
* Use {@link #addColumn(byte[], byte[], byte[])} instead
*/ */
@Deprecated
public Append add(byte [] family, byte [] qualifier, byte [] value) { public Append add(byte [] family, byte [] qualifier, byte [] value) {
return this.addColumn(family, qualifier, value);
}
/**
* Add the specified column and value to this Append operation.
* @param family family name
* @param qualifier column qualifier
* @param value value to append to specified column
* @return this
*/
public Append addColumn(byte[] family, byte[] qualifier, byte[] value) {
KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value); KeyValue kv = new KeyValue(this.row, family, qualifier, this.ts, KeyValue.Type.Put, value);
return add(kv); return add(kv);
} }

View File

@ -163,7 +163,7 @@ public class TestRpcControllerFactory {
counter = verifyCount(counter); counter = verifyCount(counter);
Append append = new Append(row); Append append = new Append(row);
append.add(fam1, fam1, Bytes.toBytes("val2")); append.addColumn(fam1, fam1, Bytes.toBytes("val2"));
table.append(append); table.append(append);
counter = verifyCount(counter); counter = verifyCount(counter);

View File

@ -1558,7 +1558,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
void testRow(final int i) throws IOException { void testRow(final int i) throws IOException {
byte [] bytes = format(i); byte [] bytes = format(i);
Append append = new Append(bytes); Append append = new Append(bytes);
append.add(FAMILY_NAME, getQualifier(), bytes); append.addColumn(FAMILY_NAME, getQualifier(), bytes);
updateValueSize(this.table.append(append)); updateValueSize(this.table.append(append));
} }
} }

View File

@ -199,7 +199,7 @@ public class TestAsyncTable {
char suffix = ':'; char suffix = ':';
AtomicLong suffixCount = new AtomicLong(0L); AtomicLong suffixCount = new AtomicLong(0L);
IntStream.range(0, count).forEachOrdered( IntStream.range(0, count).forEachOrdered(
i -> table.append(new Append(row).add(FAMILY, QUALIFIER, Bytes.toBytes("" + i + suffix))) i -> table.append(new Append(row).addColumn(FAMILY, QUALIFIER, Bytes.toBytes("" + i + suffix)))
.thenAccept(r -> { .thenAccept(r -> {
suffixCount.addAndGet(Bytes.toString(r.getValue(FAMILY, QUALIFIER)).chars() suffixCount.addAndGet(Bytes.toString(r.getValue(FAMILY, QUALIFIER)).chars()
.filter(x -> x == suffix).count()); .filter(x -> x == suffix).count());

View File

@ -186,7 +186,7 @@ public class TestAsyncTableBatch {
actions.add(new Put(Bytes.toBytes(1)).addColumn(FAMILY, CQ, Bytes.toBytes((long) 2))); actions.add(new Put(Bytes.toBytes(1)).addColumn(FAMILY, CQ, Bytes.toBytes((long) 2)));
actions.add(new Delete(Bytes.toBytes(2))); actions.add(new Delete(Bytes.toBytes(2)));
actions.add(new Increment(Bytes.toBytes(3)).addColumn(FAMILY, CQ, 1)); actions.add(new Increment(Bytes.toBytes(3)).addColumn(FAMILY, CQ, 1));
actions.add(new Append(Bytes.toBytes(4)).add(FAMILY, CQ, Bytes.toBytes(4))); actions.add(new Append(Bytes.toBytes(4)).addColumn(FAMILY, CQ, Bytes.toBytes(4)));
List<Object> results = table.batchAll(actions).get(); List<Object> results = table.batchAll(actions).get();
assertEquals(5, results.size()); assertEquals(5, results.size());
Result getResult = (Result) results.get(0); Result getResult = (Result) results.get(0);

View File

@ -103,9 +103,9 @@ public class TestAsyncTableNoncedRetry {
@Test @Test
public void testAppend() throws InterruptedException, ExecutionException { public void testAppend() throws InterruptedException, ExecutionException {
RawAsyncTable table = ASYNC_CONN.getRawTable(TABLE_NAME); RawAsyncTable table = ASYNC_CONN.getRawTable(TABLE_NAME);
Result result = table.append(new Append(row).add(FAMILY, QUALIFIER, VALUE)).get(); Result result = table.append(new Append(row).addColumn(FAMILY, QUALIFIER, VALUE)).get();
assertArrayEquals(VALUE, result.getValue(FAMILY, QUALIFIER)); assertArrayEquals(VALUE, result.getValue(FAMILY, QUALIFIER));
result = table.append(new Append(row).add(FAMILY, QUALIFIER, VALUE)).get(); result = table.append(new Append(row).addColumn(FAMILY, QUALIFIER, VALUE)).get();
// the second call should have no effect as we always generate the same nonce. // the second call should have no effect as we always generate the same nonce.
assertArrayEquals(VALUE, result.getValue(FAMILY, QUALIFIER)); assertArrayEquals(VALUE, result.getValue(FAMILY, QUALIFIER));
result = table.get(new Get(row)).get(); result = table.get(new Get(row)).get();

View File

@ -209,7 +209,7 @@ public class TestFromClientSide {
try { try {
Append append = new Append(ROW); Append append = new Append(ROW);
append.add(TEST_UTIL.fam1, QUALIFIER, VALUE); append.addColumn(TEST_UTIL.fam1, QUALIFIER, VALUE);
Result result = table.append(append); Result result = table.append(append);
// Verify expected result // Verify expected result
@ -1463,7 +1463,7 @@ public class TestFromClientSide {
table.delete(delete); table.delete(delete);
Append append = new Append(ROW); Append append = new Append(ROW);
append.add(FAMILY, null, VALUE); append.addColumn(FAMILY, null, VALUE);
table.append(append); table.append(append);
getTestNull(table, ROW, FAMILY, VALUE); getTestNull(table, ROW, FAMILY, VALUE);
@ -4625,10 +4625,10 @@ public class TestFromClientSide {
Table table = TEST_UTIL.createTable(tableName, FAMILY); Table table = TEST_UTIL.createTable(tableName, FAMILY);
Append append1 = new Append(Bytes.toBytes("row1")); Append append1 = new Append(Bytes.toBytes("row1"));
append1.setReturnResults(false); append1.setReturnResults(false);
append1.add(FAMILY, Bytes.toBytes("f1"), Bytes.toBytes("value1")); append1.addColumn(FAMILY, Bytes.toBytes("f1"), Bytes.toBytes("value1"));
Append append2 = new Append(Bytes.toBytes("row1")); Append append2 = new Append(Bytes.toBytes("row1"));
append2.setReturnResults(false); append2.setReturnResults(false);
append2.add(FAMILY, Bytes.toBytes("f1"), Bytes.toBytes("value2")); append2.addColumn(FAMILY, Bytes.toBytes("f1"), Bytes.toBytes("value2"));
List<Append> appends = new ArrayList<>(); List<Append> appends = new ArrayList<>();
appends.add(append1); appends.add(append1);
appends.add(append2); appends.add(append2);
@ -4653,15 +4653,15 @@ public class TestFromClientSide {
Bytes.toBytes("b"), Bytes.toBytes("a"), Bytes.toBytes("c") Bytes.toBytes("b"), Bytes.toBytes("a"), Bytes.toBytes("c")
}; };
Append a = new Append(ROW); Append a = new Append(ROW);
a.add(FAMILY, QUALIFIERS[0], v1); a.addColumn(FAMILY, QUALIFIERS[0], v1);
a.add(FAMILY, QUALIFIERS[1], v2); a.addColumn(FAMILY, QUALIFIERS[1], v2);
a.setReturnResults(false); a.setReturnResults(false);
assertEmptyResult(t.append(a)); assertEmptyResult(t.append(a));
a = new Append(ROW); a = new Append(ROW);
a.add(FAMILY, QUALIFIERS[0], v2); a.addColumn(FAMILY, QUALIFIERS[0], v2);
a.add(FAMILY, QUALIFIERS[1], v1); a.addColumn(FAMILY, QUALIFIERS[1], v1);
a.add(FAMILY, QUALIFIERS[2], v2); a.addColumn(FAMILY, QUALIFIERS[2], v2);
Result r = t.append(a); Result r = t.append(a);
assertEquals(0, Bytes.compareTo(Bytes.add(v1, v2), r.getValue(FAMILY, QUALIFIERS[0]))); assertEquals(0, Bytes.compareTo(Bytes.add(v1, v2), r.getValue(FAMILY, QUALIFIERS[0])));
assertEquals(0, Bytes.compareTo(Bytes.add(v2, v1), r.getValue(FAMILY, QUALIFIERS[1]))); assertEquals(0, Bytes.compareTo(Bytes.add(v2, v1), r.getValue(FAMILY, QUALIFIERS[1])));
@ -4683,16 +4683,16 @@ public class TestFromClientSide {
Put put_1 = new Put(row3); Put put_1 = new Put(row3);
put_1.addColumn(FAMILY, qual, Bytes.toBytes("put")); put_1.addColumn(FAMILY, qual, Bytes.toBytes("put"));
Append append_0 = new Append(row1); Append append_0 = new Append(row1);
append_0.add(FAMILY, qual, Bytes.toBytes("i")); append_0.addColumn(FAMILY, qual, Bytes.toBytes("i"));
Append append_1 = new Append(row1); Append append_1 = new Append(row1);
append_1.add(FAMILY, qual, Bytes.toBytes("k")); append_1.addColumn(FAMILY, qual, Bytes.toBytes("k"));
Append append_2 = new Append(row1); Append append_2 = new Append(row1);
append_2.add(FAMILY, qual, Bytes.toBytes("e")); append_2.addColumn(FAMILY, qual, Bytes.toBytes("e"));
if (!walUsed) { if (!walUsed) {
append_2.setDurability(Durability.SKIP_WAL); append_2.setDurability(Durability.SKIP_WAL);
} }
Append append_3 = new Append(row1); Append append_3 = new Append(row1);
append_3.add(FAMILY, qual, Bytes.toBytes("a")); append_3.addColumn(FAMILY, qual, Bytes.toBytes("a"));
Scan s = new Scan(); Scan s = new Scan();
s.setCaching(1); s.setCaching(1);
t.append(append_0); t.append(append_0);
@ -6416,7 +6416,7 @@ public class TestFromClientSide {
// expected // expected
} }
try { try {
t.append(new Append(ROW).add(FAMILY, QUALIFIER, new byte[10 * 1024])); t.append(new Append(ROW).addColumn(FAMILY, QUALIFIER, new byte[10 * 1024]));
fail("Oversize cell failed to trigger exception"); fail("Oversize cell failed to trigger exception");
} catch (IOException e) { } catch (IOException e) {
// expected // expected

View File

@ -597,7 +597,7 @@ public class TestFromClientSide3 {
ExecutorService appendService = Executors.newSingleThreadExecutor(); ExecutorService appendService = Executors.newSingleThreadExecutor();
appendService.execute(() -> { appendService.execute(() -> {
Append append = new Append(ROW); Append append = new Append(ROW);
append.add(FAMILY, QUALIFIER, VALUE); append.addColumn(FAMILY, QUALIFIER, VALUE);
try (Table table = con.getTable(tableName)) { try (Table table = con.getTable(tableName)) {
table.append(append); table.append(append);
fail("The APPEND should fail because the target lock is blocked by previous put"); fail("The APPEND should fail because the target lock is blocked by previous put");

View File

@ -103,7 +103,7 @@ public class TestMetaCache {
put.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(10)); put.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(10));
Get get = new Get(row); Get get = new Get(row);
Append append = new Append(row); Append append = new Append(row);
append.add(FAMILY, QUALIFIER, Bytes.toBytes(11)); append.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(11));
Increment increment = new Increment(row); Increment increment = new Increment(row);
increment.addColumn(FAMILY, QUALIFIER, 10); increment.addColumn(FAMILY, QUALIFIER, 10);
Delete delete = new Delete(row); Delete delete = new Delete(row);

View File

@ -476,8 +476,8 @@ public class TestMultiParallel {
inc.addColumn(BYTES_FAMILY, QUAL3, 1); inc.addColumn(BYTES_FAMILY, QUAL3, 1);
Append a = new Append(ONE_ROW); Append a = new Append(ONE_ROW);
a.add(BYTES_FAMILY, QUAL1, Bytes.toBytes("def")); a.addColumn(BYTES_FAMILY, QUAL1, Bytes.toBytes("def"));
a.add(BYTES_FAMILY, QUAL4, Bytes.toBytes("xyz")); a.addColumn(BYTES_FAMILY, QUAL4, Bytes.toBytes("xyz"));
List<Row> actions = new ArrayList<>(); List<Row> actions = new ArrayList<>();
actions.add(inc); actions.add(inc);
actions.add(a); actions.add(a);

View File

@ -100,7 +100,7 @@ public class TestPutDeleteEtcCellIteration {
Append a = new Append(ROW); Append a = new Append(ROW);
for (int i = 0; i < COUNT; i++) { for (int i = 0; i < COUNT; i++) {
byte [] bytes = Bytes.toBytes(i); byte [] bytes = Bytes.toBytes(i);
a.add(bytes, bytes, bytes); a.addColumn(bytes, bytes, bytes);
} }
int index = 0; int index = 0;
for (CellScanner cellScanner = a.cellScanner(); cellScanner.advance();) { for (CellScanner cellScanner = a.cellScanner(); cellScanner.advance();) {

View File

@ -74,7 +74,7 @@ public class TestResultFromCoprocessor {
t.put(put); t.put(put);
assertRowAndValue(t.get(new Get(ROW)), ROW, VALUE); assertRowAndValue(t.get(new Get(ROW)), ROW, VALUE);
Append append = new Append(ROW); Append append = new Append(ROW);
append.add(FAMILY, QUAL, FIXED_VALUE); append.addColumn(FAMILY, QUAL, FIXED_VALUE);
assertRowAndValue(t.append(append), ROW, FIXED_VALUE); assertRowAndValue(t.append(append), ROW, FIXED_VALUE);
assertRowAndValue(t.get(new Get(ROW)), ROW, Bytes.add(VALUE, FIXED_VALUE)); assertRowAndValue(t.get(new Get(ROW)), ROW, Bytes.add(VALUE, FIXED_VALUE));
} }

View File

@ -196,7 +196,7 @@ public class TestHTableWrapper {
private void checkAppend() throws IOException { private void checkAppend() throws IOException {
final byte[] appendValue = Bytes.toBytes("append"); final byte[] appendValue = Bytes.toBytes("append");
Append append = new Append(qualifierCol1).add(TEST_FAMILY, qualifierCol1, appendValue); Append append = new Append(qualifierCol1).addColumn(TEST_FAMILY, qualifierCol1, appendValue);
Result appendResult = hTableInterface.append(append); Result appendResult = hTableInterface.append(append);
byte[] appendedRow = appendResult.getRow(); byte[] appendedRow = appendResult.getRow();
checkRowValue(appendedRow, appendValue); checkRowValue(appendedRow, appendValue);

View File

@ -286,7 +286,7 @@ public class TestRegionObserverInterface {
Table table = util.createTable(tableName, new byte[][] { A, B, C }); Table table = util.createTable(tableName, new byte[][] { A, B, C });
try { try {
Append app = new Append(Bytes.toBytes(0)); Append app = new Append(Bytes.toBytes(0));
app.add(A, A, A); app.addColumn(A, A, A);
verifyMethodResult(SimpleRegionObserver.class, verifyMethodResult(SimpleRegionObserver.class,
new String[] { "hadPreAppend", "hadPostAppend", "hadPreAppendAfterRowLock" }, tableName, new String[] { "hadPreAppend", "hadPostAppend", "hadPreAppendAfterRowLock" }, tableName,

View File

@ -132,7 +132,7 @@ public class TestSpaceQuotas {
@Test @Test
public void testNoInsertsWithAppend() throws Exception { public void testNoInsertsWithAppend() throws Exception {
Append a = new Append(Bytes.toBytes("to_reject")); Append a = new Append(Bytes.toBytes("to_reject"));
a.add( a.addColumn(
Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject"));
writeUntilViolationAndVerifyViolation(SpaceViolationPolicy.NO_INSERTS, a); writeUntilViolationAndVerifyViolation(SpaceViolationPolicy.NO_INSERTS, a);
} }
@ -168,7 +168,7 @@ public class TestSpaceQuotas {
@Test @Test
public void testNoWritesWithAppend() throws Exception { public void testNoWritesWithAppend() throws Exception {
Append a = new Append(Bytes.toBytes("to_reject")); Append a = new Append(Bytes.toBytes("to_reject"));
a.add( a.addColumn(
Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject"));
writeUntilViolationAndVerifyViolation(SpaceViolationPolicy.NO_WRITES, a); writeUntilViolationAndVerifyViolation(SpaceViolationPolicy.NO_WRITES, a);
} }

View File

@ -131,12 +131,12 @@ public class TestAtomicOperation {
String v2 = " is... 42."; String v2 = " is... 42.";
Append a = new Append(row); Append a = new Append(row);
a.setReturnResults(false); a.setReturnResults(false);
a.add(fam1, qual1, Bytes.toBytes(v1)); a.addColumn(fam1, qual1, Bytes.toBytes(v1));
a.add(fam1, qual2, Bytes.toBytes(v2)); a.addColumn(fam1, qual2, Bytes.toBytes(v2));
assertTrue(region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE).isEmpty()); assertTrue(region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE).isEmpty());
a = new Append(row); a = new Append(row);
a.add(fam1, qual1, Bytes.toBytes(v2)); a.addColumn(fam1, qual1, Bytes.toBytes(v2));
a.add(fam1, qual2, Bytes.toBytes(v1)); a.addColumn(fam1, qual2, Bytes.toBytes(v1));
Result result = region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE); Result result = region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE);
assertEquals(0, Bytes.compareTo(Bytes.toBytes(v1+v2), result.getValue(fam1, qual1))); assertEquals(0, Bytes.compareTo(Bytes.toBytes(v1+v2), result.getValue(fam1, qual1)));
assertEquals(0, Bytes.compareTo(Bytes.toBytes(v2+v1), result.getValue(fam1, qual2))); assertEquals(0, Bytes.compareTo(Bytes.toBytes(v2+v1), result.getValue(fam1, qual2)));
@ -147,8 +147,8 @@ public class TestAtomicOperation {
initHRegion(tableName, name.getMethodName(), fam1); initHRegion(tableName, name.getMethodName(), fam1);
final String v1 = "Value"; final String v1 = "Value";
final Append a = new Append(row); final Append a = new Append(row);
a.add(fam1, qual1, Bytes.toBytes(v1)); a.addColumn(fam1, qual1, Bytes.toBytes(v1));
a.add(fam2, qual2, Bytes.toBytes(v1)); a.addColumn(fam2, qual2, Bytes.toBytes(v1));
Result result = null; Result result = null;
try { try {
result = region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE); result = region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE);
@ -327,9 +327,9 @@ public class TestAtomicOperation {
for (int i=0; i<numOps; i++) { for (int i=0; i<numOps; i++) {
try { try {
Append a = new Append(row); Append a = new Append(row);
a.add(fam1, qual1, val); a.addColumn(fam1, qual1, val);
a.add(fam1, qual2, val); a.addColumn(fam1, qual2, val);
a.add(fam2, qual3, val); a.addColumn(fam2, qual3, val);
a.setDurability(Durability.ASYNC_WAL); a.setDurability(Durability.ASYNC_WAL);
region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE); region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE);

View File

@ -1387,7 +1387,7 @@ public class TestHRegion {
boolean exceptionCaught = false; boolean exceptionCaught = false;
Append append = new Append(Bytes.toBytes("somerow")); Append append = new Append(Bytes.toBytes("somerow"));
append.setDurability(Durability.SKIP_WAL); append.setDurability(Durability.SKIP_WAL);
append.add(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"), append.addColumn(Bytes.toBytes("somefamily"), Bytes.toBytes("somequalifier"),
Bytes.toBytes("somevalue")); Bytes.toBytes("somevalue"));
try { try {
region.append(append); region.append(append);
@ -4364,7 +4364,7 @@ public class TestHRegion {
int count = 0; int count = 0;
while (count < appendCounter) { while (count < appendCounter) {
Append app = new Append(appendRow); Append app = new Append(appendRow);
app.add(family, qualifier, CHAR); app.addColumn(family, qualifier, CHAR);
count++; count++;
try { try {
region.append(app); region.append(app);
@ -6167,7 +6167,7 @@ public class TestHRegion {
edge.setValue(10); edge.setValue(10);
Append a = new Append(row); Append a = new Append(row);
a.setDurability(Durability.SKIP_WAL); a.setDurability(Durability.SKIP_WAL);
a.add(fam1, qual1, qual1); a.addColumn(fam1, qual1, qual1);
region.append(a); region.append(a);
Result result = region.get(new Get(row)); Result result = region.get(new Get(row));

View File

@ -365,7 +365,7 @@ public class TestRegionServerMetrics {
for(int count = 0; count< 73; count++) { for(int count = 0; count< 73; count++) {
Append append = new Append(row); Append append = new Append(row);
append.add(cf, qualifier, Bytes.toBytes(",Test")); append.addColumn(cf, qualifier, Bytes.toBytes(",Test"));
table.append(append); table.append(append);
} }

View File

@ -284,7 +284,7 @@ public class TestRegionServerReadRequestMetrics {
// test for append // test for append
append = new Append(ROW1); append = new Append(ROW1);
append.add(CF1, COL2, VAL2); append.addColumn(CF1, COL2, VAL2);
result = table.append(append); result = table.append(append);
resultCount = result.isEmpty() ? 0 : 1; resultCount = result.isEmpty() ? 0 : 1;
testReadRequests(resultCount, 1, 0); testReadRequests(resultCount, 1, 0);

View File

@ -456,7 +456,7 @@ public class TestTags {
put.setAttribute("visibility", Bytes.toBytes("tag1")); put.setAttribute("visibility", Bytes.toBytes("tag1"));
table.put(put); table.put(put);
Append append = new Append(row3); Append append = new Append(row3);
append.add(f, q, Bytes.toBytes("b")); append.addColumn(f, q, Bytes.toBytes("b"));
table.append(append); table.append(append);
TestCoprocessorForTags.checkTagPresence = true; TestCoprocessorForTags.checkTagPresence = true;
scanner = table.getScanner(new Scan().setStartRow(row3)); scanner = table.getScanner(new Scan().setStartRow(row3));

View File

@ -1163,7 +1163,7 @@ public class TestAccessController extends SecureTestUtil {
Put put = new Put(row); Put put = new Put(row);
put.addColumn(TEST_FAMILY, qualifier, Bytes.toBytes(1)); put.addColumn(TEST_FAMILY, qualifier, Bytes.toBytes(1));
Append append = new Append(row); Append append = new Append(row);
append.add(TEST_FAMILY, qualifier, Bytes.toBytes(2)); append.addColumn(TEST_FAMILY, qualifier, Bytes.toBytes(2));
try(Connection conn = ConnectionFactory.createConnection(conf); try(Connection conn = ConnectionFactory.createConnection(conf);
Table t = conn.getTable(TEST_TABLE)) { Table t = conn.getTable(TEST_TABLE)) {
t.put(put); t.put(put);

View File

@ -636,12 +636,12 @@ public abstract class TestVisibilityLabels {
Result result = table.get(get); Result result = table.get(get);
assertTrue(result.isEmpty()); assertTrue(result.isEmpty());
Append append = new Append(row1); Append append = new Append(row1);
append.add(fam, qual, Bytes.toBytes("b")); append.addColumn(fam, qual, Bytes.toBytes("b"));
table.append(append); table.append(append);
result = table.get(get); result = table.get(get);
assertTrue(result.isEmpty()); assertTrue(result.isEmpty());
append = new Append(row1); append = new Append(row1);
append.add(fam, qual, Bytes.toBytes("c")); append.addColumn(fam, qual, Bytes.toBytes("c"));
append.setCellVisibility(new CellVisibility(SECRET)); append.setCellVisibility(new CellVisibility(SECRET));
table.append(append); table.append(append);
result = table.get(get); result = table.get(get);

View File

@ -191,7 +191,7 @@ public class TestVisibilityWithCheckAuths {
try (Connection connection = ConnectionFactory.createConnection(conf); try (Connection connection = ConnectionFactory.createConnection(conf);
Table table = connection.getTable(tableName)) { Table table = connection.getTable(tableName)) {
Append append = new Append(row1); Append append = new Append(row1);
append.add(fam, qual, Bytes.toBytes("b")); append.addColumn(fam, qual, Bytes.toBytes("b"));
table.append(append); table.append(append);
} }
return null; return null;
@ -204,7 +204,7 @@ public class TestVisibilityWithCheckAuths {
try (Connection connection = ConnectionFactory.createConnection(conf); try (Connection connection = ConnectionFactory.createConnection(conf);
Table table = connection.getTable(tableName)) { Table table = connection.getTable(tableName)) {
Append append = new Append(row1); Append append = new Append(row1);
append.add(fam, qual, Bytes.toBytes("c")); append.addColumn(fam, qual, Bytes.toBytes("c"));
append.setCellVisibility(new CellVisibility(PUBLIC)); append.setCellVisibility(new CellVisibility(PUBLIC));
table.append(append); table.append(append);
Assert.fail("Testcase should fail with AccesDeniedException"); Assert.fail("Testcase should fail with AccesDeniedException");

View File

@ -151,7 +151,7 @@ public class MultiThreadedUpdater extends MultiThreadedWriterBase {
buf.setLength(0); // Clear the buffer buf.setLength(0); // Clear the buffer
buf.append("#").append(Bytes.toString(INCREMENT)); buf.append("#").append(Bytes.toString(INCREMENT));
buf.append(":").append(MutationType.INCREMENT.getNumber()); buf.append(":").append(MutationType.INCREMENT.getNumber());
app.add(cf, MUTATE_INFO, Bytes.toBytes(buf.toString())); app.addColumn(cf, MUTATE_INFO, Bytes.toBytes(buf.toString()));
++columnCount; ++columnCount;
if (!isBatchUpdate) { if (!isBatchUpdate) {
mutate(table, inc, rowKeyBase); mutate(table, inc, rowKeyBase);
@ -220,9 +220,9 @@ public class MultiThreadedUpdater extends MultiThreadedWriterBase {
break; break;
default: default:
buf.append(MutationType.APPEND.getNumber()); buf.append(MutationType.APPEND.getNumber());
app.add(cf, column, hashCodeBytes); app.addColumn(cf, column, hashCodeBytes);
} }
app.add(cf, MUTATE_INFO, Bytes.toBytes(buf.toString())); app.addColumn(cf, MUTATE_INFO, Bytes.toBytes(buf.toString()));
if (!isBatchUpdate) { if (!isBatchUpdate) {
mutate(table, app, rowKeyBase); mutate(table, app, rowKeyBase);
numCols.addAndGet(1); numCols.addAndGet(1);

View File

@ -228,7 +228,7 @@ public class ThriftUtilities {
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
byte[][] famAndQf = KeyValue.parseColumn(getBytes(columns.get(i))); byte[][] famAndQf = KeyValue.parseColumn(getBytes(columns.get(i)));
append.add(famAndQf[0], famAndQf[1], getBytes(values.get(i))); append.addColumn(famAndQf[0], famAndQf[1], getBytes(values.get(i)));
} }
return append; return append;
} }

View File

@ -482,7 +482,7 @@ public class ThriftUtilities {
public static Append appendFromThrift(TAppend append) throws IOException { public static Append appendFromThrift(TAppend append) throws IOException {
Append out = new Append(append.getRow()); Append out = new Append(append.getRow());
for (TColumnValue column : append.getColumns()) { for (TColumnValue column : append.getColumns()) {
out.add(column.getFamily(), column.getQualifier(), column.getValue()); out.addColumn(column.getFamily(), column.getQualifier(), column.getValue());
} }
if (append.isSetAttributes()) { if (append.isSetAttributes()) {