diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java index a655c7db16d..346eb0e4db3 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Append.java @@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.util.Bytes; *

* 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 - * {@link #add(byte[], byte[], byte[])} method. + * {@link #addColumn(byte[], byte[], byte[])} method. */ @InterfaceAudience.Public public class Append extends Mutation { @@ -104,8 +104,22 @@ public class Append extends Mutation { * @param qualifier column qualifier * @param value value to append to specified column * @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) { + 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); return add(kv); } diff --git a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java index 6aaef809b4a..567f30c6943 100644 --- a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java +++ b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/client/TestRpcControllerFactory.java @@ -163,7 +163,7 @@ public class TestRpcControllerFactory { counter = verifyCount(counter); Append append = new Append(row); - append.add(fam1, fam1, Bytes.toBytes("val2")); + append.addColumn(fam1, fam1, Bytes.toBytes("val2")); table.append(append); counter = verifyCount(counter); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java index 2c5cb65aaea..8abef2b769d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java @@ -1558,7 +1558,7 @@ public class PerformanceEvaluation extends Configured implements Tool { void testRow(final int i) throws IOException { byte [] bytes = format(i); Append append = new Append(bytes); - append.add(FAMILY_NAME, getQualifier(), bytes); + append.addColumn(FAMILY_NAME, getQualifier(), bytes); updateValueSize(this.table.append(append)); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java index 593c88ea656..2fea0ebab2f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java @@ -199,7 +199,7 @@ public class TestAsyncTable { char suffix = ':'; AtomicLong suffixCount = new AtomicLong(0L); 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 -> { suffixCount.addAndGet(Bytes.toString(r.getValue(FAMILY, QUALIFIER)).chars() .filter(x -> x == suffix).count()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java index 61ff2bea8b1..6c9dd86c619 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableBatch.java @@ -186,7 +186,7 @@ public class TestAsyncTableBatch { actions.add(new Put(Bytes.toBytes(1)).addColumn(FAMILY, CQ, Bytes.toBytes((long) 2))); actions.add(new Delete(Bytes.toBytes(2))); 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 results = table.batchAll(actions).get(); assertEquals(5, results.size()); Result getResult = (Result) results.get(0); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java index 3f7d1434662..0df8ce748b7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java @@ -103,9 +103,9 @@ public class TestAsyncTableNoncedRetry { @Test public void testAppend() throws InterruptedException, ExecutionException { 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)); - 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. assertArrayEquals(VALUE, result.getValue(FAMILY, QUALIFIER)); result = table.get(new Get(row)).get(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java index dd9024a0688..a93fbb20ec9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java @@ -209,7 +209,7 @@ public class TestFromClientSide { try { Append append = new Append(ROW); - append.add(TEST_UTIL.fam1, QUALIFIER, VALUE); + append.addColumn(TEST_UTIL.fam1, QUALIFIER, VALUE); Result result = table.append(append); // Verify expected result @@ -1463,7 +1463,7 @@ public class TestFromClientSide { table.delete(delete); Append append = new Append(ROW); - append.add(FAMILY, null, VALUE); + append.addColumn(FAMILY, null, VALUE); table.append(append); getTestNull(table, ROW, FAMILY, VALUE); @@ -4625,10 +4625,10 @@ public class TestFromClientSide { Table table = TEST_UTIL.createTable(tableName, FAMILY); Append append1 = new Append(Bytes.toBytes("row1")); 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")); append2.setReturnResults(false); - append2.add(FAMILY, Bytes.toBytes("f1"), Bytes.toBytes("value2")); + append2.addColumn(FAMILY, Bytes.toBytes("f1"), Bytes.toBytes("value2")); List appends = new ArrayList<>(); appends.add(append1); appends.add(append2); @@ -4653,15 +4653,15 @@ public class TestFromClientSide { Bytes.toBytes("b"), Bytes.toBytes("a"), Bytes.toBytes("c") }; Append a = new Append(ROW); - a.add(FAMILY, QUALIFIERS[0], v1); - a.add(FAMILY, QUALIFIERS[1], v2); + a.addColumn(FAMILY, QUALIFIERS[0], v1); + a.addColumn(FAMILY, QUALIFIERS[1], v2); a.setReturnResults(false); assertEmptyResult(t.append(a)); a = new Append(ROW); - a.add(FAMILY, QUALIFIERS[0], v2); - a.add(FAMILY, QUALIFIERS[1], v1); - a.add(FAMILY, QUALIFIERS[2], v2); + a.addColumn(FAMILY, QUALIFIERS[0], v2); + a.addColumn(FAMILY, QUALIFIERS[1], v1); + a.addColumn(FAMILY, QUALIFIERS[2], v2); Result r = t.append(a); 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]))); @@ -4683,16 +4683,16 @@ public class TestFromClientSide { Put put_1 = new Put(row3); put_1.addColumn(FAMILY, qual, Bytes.toBytes("put")); 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_1.add(FAMILY, qual, Bytes.toBytes("k")); + append_1.addColumn(FAMILY, qual, Bytes.toBytes("k")); Append append_2 = new Append(row1); - append_2.add(FAMILY, qual, Bytes.toBytes("e")); + append_2.addColumn(FAMILY, qual, Bytes.toBytes("e")); if (!walUsed) { append_2.setDurability(Durability.SKIP_WAL); } 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(); s.setCaching(1); t.append(append_0); @@ -6416,7 +6416,7 @@ public class TestFromClientSide { // expected } 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"); } catch (IOException e) { // expected diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java index 9eaa716cb53..668bfbbc25f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java @@ -597,7 +597,7 @@ public class TestFromClientSide3 { ExecutorService appendService = Executors.newSingleThreadExecutor(); appendService.execute(() -> { Append append = new Append(ROW); - append.add(FAMILY, QUALIFIER, VALUE); + append.addColumn(FAMILY, QUALIFIER, VALUE); try (Table table = con.getTable(tableName)) { table.append(append); fail("The APPEND should fail because the target lock is blocked by previous put"); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java index 7a32e6afc20..883ae3e077f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java @@ -103,7 +103,7 @@ public class TestMetaCache { put.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(10)); Get get = new Get(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.addColumn(FAMILY, QUALIFIER, 10); Delete delete = new Delete(row); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java index a3bcc76685d..0454ed86279 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiParallel.java @@ -476,8 +476,8 @@ public class TestMultiParallel { inc.addColumn(BYTES_FAMILY, QUAL3, 1); Append a = new Append(ONE_ROW); - a.add(BYTES_FAMILY, QUAL1, Bytes.toBytes("def")); - a.add(BYTES_FAMILY, QUAL4, Bytes.toBytes("xyz")); + a.addColumn(BYTES_FAMILY, QUAL1, Bytes.toBytes("def")); + a.addColumn(BYTES_FAMILY, QUAL4, Bytes.toBytes("xyz")); List actions = new ArrayList<>(); actions.add(inc); actions.add(a); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutDeleteEtcCellIteration.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutDeleteEtcCellIteration.java index 60eb92f5754..53cbd0f0a7d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutDeleteEtcCellIteration.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutDeleteEtcCellIteration.java @@ -100,7 +100,7 @@ public class TestPutDeleteEtcCellIteration { Append a = new Append(ROW); for (int i = 0; i < COUNT; i++) { byte [] bytes = Bytes.toBytes(i); - a.add(bytes, bytes, bytes); + a.addColumn(bytes, bytes, bytes); } int index = 0; for (CellScanner cellScanner = a.cellScanner(); cellScanner.advance();) { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java index 4a81cc25d9f..ebbf47a3142 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultFromCoprocessor.java @@ -74,7 +74,7 @@ public class TestResultFromCoprocessor { t.put(put); assertRowAndValue(t.get(new Get(ROW)), ROW, VALUE); 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.get(new Get(ROW)), ROW, Bytes.add(VALUE, FIXED_VALUE)); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestHTableWrapper.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestHTableWrapper.java index 9f20ba23281..4f80876887e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestHTableWrapper.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestHTableWrapper.java @@ -196,7 +196,7 @@ public class TestHTableWrapper { private void checkAppend() throws IOException { 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); byte[] appendedRow = appendResult.getRow(); checkRowValue(appendedRow, appendValue); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java index 7b4cc40d87d..c4924bb4efd 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java @@ -286,7 +286,7 @@ public class TestRegionObserverInterface { Table table = util.createTable(tableName, new byte[][] { A, B, C }); try { Append app = new Append(Bytes.toBytes(0)); - app.add(A, A, A); + app.addColumn(A, A, A); verifyMethodResult(SimpleRegionObserver.class, new String[] { "hadPreAppend", "hadPostAppend", "hadPreAppendAfterRowLock" }, tableName, diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotas.java index e21647f14a1..23a55e2cb72 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/quotas/TestSpaceQuotas.java @@ -132,7 +132,7 @@ public class TestSpaceQuotas { @Test public void testNoInsertsWithAppend() throws Exception { Append a = new Append(Bytes.toBytes("to_reject")); - a.add( + a.addColumn( Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); writeUntilViolationAndVerifyViolation(SpaceViolationPolicy.NO_INSERTS, a); } @@ -168,7 +168,7 @@ public class TestSpaceQuotas { @Test public void testNoWritesWithAppend() throws Exception { Append a = new Append(Bytes.toBytes("to_reject")); - a.add( + a.addColumn( Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); writeUntilViolationAndVerifyViolation(SpaceViolationPolicy.NO_WRITES, a); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java index 1cef625ef86..1936c980c37 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestAtomicOperation.java @@ -131,12 +131,12 @@ public class TestAtomicOperation { String v2 = " is... 42."; Append a = new Append(row); a.setReturnResults(false); - a.add(fam1, qual1, Bytes.toBytes(v1)); - a.add(fam1, qual2, Bytes.toBytes(v2)); + a.addColumn(fam1, qual1, Bytes.toBytes(v1)); + a.addColumn(fam1, qual2, Bytes.toBytes(v2)); assertTrue(region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE).isEmpty()); a = new Append(row); - a.add(fam1, qual1, Bytes.toBytes(v2)); - a.add(fam1, qual2, Bytes.toBytes(v1)); + a.addColumn(fam1, qual1, Bytes.toBytes(v2)); + a.addColumn(fam1, qual2, Bytes.toBytes(v1)); 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(v2+v1), result.getValue(fam1, qual2))); @@ -147,8 +147,8 @@ public class TestAtomicOperation { initHRegion(tableName, name.getMethodName(), fam1); final String v1 = "Value"; final Append a = new Append(row); - a.add(fam1, qual1, Bytes.toBytes(v1)); - a.add(fam2, qual2, Bytes.toBytes(v1)); + a.addColumn(fam1, qual1, Bytes.toBytes(v1)); + a.addColumn(fam2, qual2, Bytes.toBytes(v1)); Result result = null; try { result = region.append(a, HConstants.NO_NONCE, HConstants.NO_NONCE); @@ -327,9 +327,9 @@ public class TestAtomicOperation { for (int i=0; i