From b45a805a8f33a29c220b1b2051ce51c1064ac88b Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Sat, 19 Feb 2022 16:30:30 +0100 Subject: [PATCH 1/5] HBASE-26762: Un-Deprecate and improve documentation for Scan#setRowPrefixFilter Signed-off-by: Niels Basjes --- .../org/apache/hadoop/hbase/client/Scan.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java index 3ddf8ba72865..fc8da425b99c 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java @@ -339,6 +339,11 @@ public Scan setTimestamp(long timestamp) { *

* If the specified row does not exist, the Scanner will start from the next closest row after the * specified row. + *

+ * Note:Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])}. + * Doing so will make the scan result unexpected or even undefined. + *

* @param startRow row to start scanner at or after * @return this * @throws IllegalArgumentException if startRow does not meet criteria for a row key (when length @@ -354,7 +359,9 @@ public Scan withStartRow(byte[] startRow) { * If the specified row does not exist, or the {@code inclusive} is {@code false}, the Scanner * will start from the next closest row after the specified row. *

- * Note: When use {@link #setRowPrefixFilter(byte[])}, the result might be unexpected. + * Note:Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])}. + * Doing so will make the scan result unexpected or even undefined. *

* @param startRow row to start scanner at or after * @param inclusive whether we should include the start row when scan @@ -377,8 +384,9 @@ public Scan withStartRow(byte[] startRow, boolean inclusive) { *

* The scan will include rows that are lexicographically less than the provided stopRow. *

- * Note: When doing a filter for a rowKey Prefix use - * {@link #setRowPrefixFilter(byte[])}. The 'trailing 0' will not yield the desired result. + * Note:Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])}. + * Doing so will make the scan result unexpected or even undefined. *

* @param stopRow row to end at (exclusive) * @return this @@ -394,6 +402,11 @@ public Scan withStopRow(byte[] stopRow) { *

* The scan will include rows that are lexicographically less than (or equal to if * {@code inclusive} is {@code true}) the provided stopRow. + *

+ * Note:Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])}. + * Doing so will make the scan result unexpected or even undefined. + *

* @param stopRow row to end at * @param inclusive whether we should include the stop row when scan * @return this @@ -416,17 +429,11 @@ public Scan withStopRow(byte[] stopRow, boolean inclusive) { *

This is a utility method that converts the desired rowPrefix into the appropriate values * for the startRow and stopRow to achieve the desired result.

*

This can safely be used in combination with setFilter.

- *

NOTE: Doing a {@link #withStartRow(byte[])} and/or {@link #withStopRow(byte[])} - * after this method will yield undefined results.

+ *

This CANNOT be used in combination with withStartRow and/or withStopRow. + * Such a combination will yield unexpected and even undefined results.

* @param rowPrefix the prefix all rows must start with. (Set null to remove the filter.) * @return this - * @deprecated since 3.0.0. The scan result might be unexpected in some cases. - * e.g. startRow : "112" and rowPrefixFilter : "11" - * The Result of this scan might contains : "111" - * This method implements the filter by setting startRow and stopRow, - * but does not take care of the scenario where startRow has been set. */ - @Deprecated public Scan setRowPrefixFilter(byte[] rowPrefix) { if (rowPrefix == null) { withStartRow(HConstants.EMPTY_START_ROW); From a064359f19906abab1c184552a65fc8e5d79f05a Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Sat, 19 Feb 2022 17:33:07 +0100 Subject: [PATCH 2/5] HBASE-26762: Remove test that proves incorrect usage yields unexpected results Signed-off-by: Niels Basjes --- .../hbase/filter/TestScanRowPrefix.java | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java index dcf7b0082ce6..f53195471b99 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java @@ -206,45 +206,6 @@ public void testPrefixScanning() throws IOException { verifyScanResult(table, scan, expected0, "Scan after prefix reset failed"); } - @Test - public void testRowPrefixFilterAndStartRow() throws IOException { - final TableName tableName = TableName.valueOf(name.getMethodName()); - createTable(tableName,"F"); - Table table = openTable(tableName); - - final byte[][] rowkeys = {Bytes.toBytes("111"), Bytes.toBytes("112")}; - final byte[] prefixFilter = Bytes.toBytes("11"); - for (byte[] rowkey: rowkeys) { - Put p = new Put(rowkey); - p.addColumn(Bytes.toBytes("F"), Bytes.toBytes("f"), Bytes.toBytes("test value")); - table.put(p); - } - - List expected0 = new ArrayList<>(); - expected0.add(rowkeys[0]); - expected0.add(rowkeys[1]); - - List expected1 = new ArrayList<>(); - expected1.add(rowkeys[1]); - - // ======== - // First scan - // Set startRow before setRowPrefixFilter - Scan scan = new Scan(); - scan.withStartRow(rowkeys[1]); - scan.setRowPrefixFilter(prefixFilter); - verifyScanResult(table, scan, expected0, "Set startRow before setRowPrefixFilter unexpected"); - - // ======== - // Second scan - // Set startRow after setRowPrefixFilter - // The result is different from first scan - scan = new Scan(); - scan.setRowPrefixFilter(prefixFilter); - scan.withStartRow(rowkeys[1]); - verifyScanResult(table, scan, expected1, "Set startRow after setRowPrefixFilter unexpected"); - } - private void verifyScanResult(Table table, Scan scan, List expectedKeys, String message) { List actualKeys = new ArrayList<>(); try { From 3129b5f7117b51d590055d9088a1a34795029340 Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Sun, 20 Feb 2022 15:47:33 +0100 Subject: [PATCH 3/5] HBASE-26762: Rename and deprecate setRowPrefixFilter to setStartStopRowForPrefixScan Signed-off-by: Niels Basjes --- .../hadoop/hbase/client/ImmutableScan.java | 4 +-- .../org/apache/hadoop/hbase/client/Scan.java | 35 ++++++++++++++----- .../hadoop/hbase/quotas/QuotaTableUtil.java | 8 ++--- .../hbase/client/TestImmutableScan.java | 6 ++-- .../apache/hadoop/hbase/client/TestScan.java | 2 +- .../hbase/filter/TestScanRowPrefix.java | 32 ++++++++--------- hbase-shell/src/main/ruby/hbase/table.rb | 4 +-- src/main/asciidoc/_chapters/datamodel.adoc | 2 +- 8 files changed, 56 insertions(+), 37 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java index 196d0c800f19..01ec316c798a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ImmutableScan.java @@ -95,9 +95,9 @@ public Scan withStopRow(byte[] stopRow, boolean inclusive) { } @Override - public Scan setRowPrefixFilter(byte[] rowPrefix) { + public Scan setStartStopRowForPrefixScan(byte[] rowPrefix) { throw new UnsupportedOperationException( - "ImmutableScan does not allow access to setRowPrefixFilter"); + "ImmutableScan does not allow access to setStartStopRowForPrefixScan"); } @Override diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java index fc8da425b99c..0f8fceea91be 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java @@ -340,8 +340,8 @@ public Scan setTimestamp(long timestamp) { * If the specified row does not exist, the Scanner will start from the next closest row after the * specified row. *

- * Note:Do NOT use this in combination with - * {@link #setRowPrefixFilter(byte[])}. + * Note: Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])} or {@link #setStartStopRowForPrefixScan(byte[])}. * Doing so will make the scan result unexpected or even undefined. *

* @param startRow row to start scanner at or after @@ -359,8 +359,8 @@ public Scan withStartRow(byte[] startRow) { * If the specified row does not exist, or the {@code inclusive} is {@code false}, the Scanner * will start from the next closest row after the specified row. *

- * Note:Do NOT use this in combination with - * {@link #setRowPrefixFilter(byte[])}. + * Note: Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])} or {@link #setStartStopRowForPrefixScan(byte[])}. * Doing so will make the scan result unexpected or even undefined. *

* @param startRow row to start scanner at or after @@ -384,8 +384,8 @@ public Scan withStartRow(byte[] startRow, boolean inclusive) { *

* The scan will include rows that are lexicographically less than the provided stopRow. *

- * Note:Do NOT use this in combination with - * {@link #setRowPrefixFilter(byte[])}. + * Note: Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])} or {@link #setStartStopRowForPrefixScan(byte[])}. * Doing so will make the scan result unexpected or even undefined. *

* @param stopRow row to end at (exclusive) @@ -403,8 +403,8 @@ public Scan withStopRow(byte[] stopRow) { * The scan will include rows that are lexicographically less than (or equal to if * {@code inclusive} is {@code true}) the provided stopRow. *

- * Note:Do NOT use this in combination with - * {@link #setRowPrefixFilter(byte[])}. + * Note: Do NOT use this in combination with + * {@link #setRowPrefixFilter(byte[])} or {@link #setStartStopRowForPrefixScan(byte[])}. * Doing so will make the scan result unexpected or even undefined. *

* @param stopRow row to end at @@ -433,8 +433,27 @@ public Scan withStopRow(byte[] stopRow, boolean inclusive) { * Such a combination will yield unexpected and even undefined results.

* @param rowPrefix the prefix all rows must start with. (Set null to remove the filter.) * @return this + * @deprecated since 3.0.0. The name of this method is considered to be confusing as it does not + * use a {@link Filter} but uses setting the startRow and stopRow instead. + * Use {@link #setStartStopRowForPrefixScan(byte[])} instead. */ + @Deprecated public Scan setRowPrefixFilter(byte[] rowPrefix) { + return setStartStopRowForPrefixScan(rowPrefix); + } + + /** + *

Set a filter (using stopRow and startRow) so the result set only contains rows where the + * rowKey starts with the specified prefix.

+ *

This is a utility method that converts the desired rowPrefix into the appropriate values + * for the startRow and stopRow to achieve the desired result.

+ *

This can safely be used in combination with setFilter.

+ *

This CANNOT be used in combination with withStartRow and/or withStopRow. + * Such a combination will yield unexpected and even undefined results.

+ * @param rowPrefix the prefix all rows must start with. (Set null to remove the filter.) + * @return this + */ + public Scan setStartStopRowForPrefixScan(byte[] rowPrefix) { if (rowPrefix == null) { withStartRow(HConstants.EMPTY_START_ROW); withStopRow(HConstants.EMPTY_END_ROW); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java index 624b4751b3d2..d83b4ec43e38 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java @@ -288,7 +288,7 @@ public static Scan makeQuotaSnapshotScanForTable(TableName tn) { // Limit to "u:v" column s.addColumn(QUOTA_FAMILY_USAGE, QUOTA_QUALIFIER_POLICY); if (null == tn) { - s.setRowPrefixFilter(QUOTA_TABLE_ROW_KEY_PREFIX); + s.setStartStopRowForPrefixScan(QUOTA_TABLE_ROW_KEY_PREFIX); } else { byte[] row = getTableRowKey(tn); // Limit rowspace to the "t:" prefix @@ -637,7 +637,7 @@ static void deleteTableUsageSnapshotsForNamespace(Connection connection, String throws IOException { Scan s = new Scan(); //Get rows for all tables in namespace - s.setRowPrefixFilter(Bytes.add(QUOTA_TABLE_ROW_KEY_PREFIX, Bytes.toBytes(namespace + TableName.NAMESPACE_DELIM))); + s.setStartStopRowForPrefixScan(Bytes.add(QUOTA_TABLE_ROW_KEY_PREFIX, Bytes.toBytes(namespace + TableName.NAMESPACE_DELIM))); //Scan for table usage column (u:p) in quota table s.addColumn(QUOTA_FAMILY_USAGE,QUOTA_QUALIFIER_POLICY); //Scan for table quota column (q:s) if table has a space quota defined @@ -706,7 +706,7 @@ static Scan createScanForNamespaceSnapshotSizes(String namespace) { Scan s = new Scan(); if (namespace == null || namespace.isEmpty()) { // Read all namespaces, just look at the row prefix - s.setRowPrefixFilter(QUOTA_NAMESPACE_ROW_KEY_PREFIX); + s.setStartStopRowForPrefixScan(QUOTA_NAMESPACE_ROW_KEY_PREFIX); } else { // Fetch the exact row for the table byte[] rowkey = getNamespaceRowKey(namespace); @@ -727,7 +727,7 @@ static Scan createScanForSpaceSnapshotSizes(TableName table) { Scan s = new Scan(); if (null == table) { // Read all tables, just look at the row prefix - s.setRowPrefixFilter(QUOTA_TABLE_ROW_KEY_PREFIX); + s.setStartStopRowForPrefixScan(QUOTA_TABLE_ROW_KEY_PREFIX); } else { // Fetch the exact row for the table byte[] rowkey = getTableRowKey(table); diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java index cc8cc29b18a1..f31a50f30d36 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java @@ -84,7 +84,7 @@ public void testScanCopyConstructor() throws Exception { .setReplicaId(3) .setReversed(true) .setRowOffsetPerColumnFamily(5) - .setRowPrefixFilter(Bytes.toBytes("row_")) + .setStartStopRowForPrefixScan(Bytes.toBytes("row_")) .setScanMetricsEnabled(true) .setReadType(Scan.ReadType.STREAM) .withStartRow(Bytes.toBytes("row_1")) @@ -181,10 +181,10 @@ private void testUnmodifiableSetters(Scan scanCopy) throws IOException { assertEquals("ImmutableScan does not allow access to withStopRow", e.getMessage()); } try { - scanCopy.setRowPrefixFilter(new byte[] { 1, 2 }); + scanCopy.setStartStopRowForPrefixScan(new byte[] { 1, 2 }); throw new RuntimeException("Should not reach here"); } catch (UnsupportedOperationException e) { - assertEquals("ImmutableScan does not allow access to setRowPrefixFilter", e.getMessage()); + assertEquals("ImmutableScan does not allow access to setStartStopRowForPrefixScan", e.getMessage()); } try { scanCopy.readAllVersions(); diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java index fea6333b66d1..0fbf4bb07962 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java @@ -246,7 +246,7 @@ public void testScanCopyConstructor() throws Exception { .setReplicaId(3) .setReversed(true) .setRowOffsetPerColumnFamily(5) - .setRowPrefixFilter(Bytes.toBytes("row_")) + .setStartStopRowForPrefixScan(Bytes.toBytes("row_")) .setScanMetricsEnabled(true) .setReadType(ReadType.STREAM) .withStartRow(Bytes.toBytes("row_1")) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java index f53195471b99..da5586fb75d3 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestScanRowPrefix.java @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; /** - * Test if Scan.setRowPrefixFilter works as intended. + * Test if Scan.setStartStopRowForPrefixScan works as intended. */ @Category({FilterTests.class, MediumTests.class}) public class TestScanRowPrefix extends FilterTestingCluster { @@ -64,8 +64,8 @@ public void testPrefixScanning() throws IOException { Table table = openTable(tableName); /** - * Note that about half of these tests were relevant for an different implementation approach - * of setRowPrefixFilter. These test cases have been retained to ensure that also the + * Note that about half of these tests were relevant for a different implementation approach + * of setStartStopRowForPrefixScan. These test cases have been retained to ensure that also the * edge cases found there are still covered. */ @@ -119,16 +119,16 @@ public void testPrefixScanning() throws IOException { // ======== // PREFIX 0 Scan scan = new Scan(); - scan.setRowPrefixFilter(prefix0); + scan.setStartStopRowForPrefixScan(prefix0); verifyScanResult(table, scan, expected0, "Scan empty prefix failed"); // ======== // PREFIX 1 scan = new Scan(); - scan.setRowPrefixFilter(prefix1); + scan.setStartStopRowForPrefixScan(prefix1); verifyScanResult(table, scan, expected1, "Scan normal prefix failed"); - scan.setRowPrefixFilter(null); + scan.setStartStopRowForPrefixScan(null); verifyScanResult(table, scan, expected0, "Scan after prefix reset failed"); scan = new Scan(); @@ -138,10 +138,10 @@ public void testPrefixScanning() throws IOException { // ======== // PREFIX 2 scan = new Scan(); - scan.setRowPrefixFilter(prefix2); + scan.setStartStopRowForPrefixScan(prefix2); verifyScanResult(table, scan, expected2, "Scan edge 0xFF prefix failed"); - scan.setRowPrefixFilter(null); + scan.setStartStopRowForPrefixScan(null); verifyScanResult(table, scan, expected0, "Scan after prefix reset failed"); scan = new Scan(); @@ -151,10 +151,10 @@ public void testPrefixScanning() throws IOException { // ======== // PREFIX 3 scan = new Scan(); - scan.setRowPrefixFilter(prefix3); + scan.setStartStopRowForPrefixScan(prefix3); verifyScanResult(table, scan, expected3, "Scan normal with 0x00 ends failed"); - scan.setRowPrefixFilter(null); + scan.setStartStopRowForPrefixScan(null); verifyScanResult(table, scan, expected0, "Scan after prefix reset failed"); scan = new Scan(); @@ -164,10 +164,10 @@ public void testPrefixScanning() throws IOException { // ======== // PREFIX 4 scan = new Scan(); - scan.setRowPrefixFilter(prefix4); + scan.setStartStopRowForPrefixScan(prefix4); verifyScanResult(table, scan, expected4, "Scan end prefix failed"); - scan.setRowPrefixFilter(null); + scan.setStartStopRowForPrefixScan(null); verifyScanResult(table, scan, expected0, "Scan after prefix reset failed"); scan = new Scan(); @@ -178,13 +178,13 @@ public void testPrefixScanning() throws IOException { // COMBINED // Prefix + Filter scan = new Scan(); - scan.setRowPrefixFilter(prefix1); + scan.setStartStopRowForPrefixScan(prefix1); verifyScanResult(table, scan, expected1, "Prefix filter failed"); scan.setFilter(new ColumnPrefixFilter(prefix2)); verifyScanResult(table, scan, expected2, "Combined Prefix + Filter failed"); - scan.setRowPrefixFilter(null); + scan.setStartStopRowForPrefixScan(null); verifyScanResult(table, scan, expected2, "Combined Prefix + Filter; removing Prefix failed"); scan.setFilter(null); @@ -196,13 +196,13 @@ public void testPrefixScanning() throws IOException { scan.setFilter(new ColumnPrefixFilter(prefix2)); verifyScanResult(table, scan, expected2, "Test filter failed"); - scan.setRowPrefixFilter(prefix1); + scan.setStartStopRowForPrefixScan(prefix1); verifyScanResult(table, scan, expected2, "Combined Filter + Prefix failed"); scan.setFilter(null); verifyScanResult(table, scan, expected1, "Combined Filter + Prefix ; removing Filter failed"); - scan.setRowPrefixFilter(null); + scan.setStartStopRowForPrefixScan(null); verifyScanResult(table, scan, expected0, "Scan after prefix reset failed"); } diff --git a/hbase-shell/src/main/ruby/hbase/table.rb b/hbase-shell/src/main/ruby/hbase/table.rb index 0cd917efcc16..68d7349c00ae 100644 --- a/hbase-shell/src/main/ruby/hbase/table.rb +++ b/hbase-shell/src/main/ruby/hbase/table.rb @@ -208,7 +208,7 @@ def _deleterows_internal(row, column = nil, # create scan to get table names using prefix scan = org.apache.hadoop.hbase.client.Scan.new - scan.setRowPrefixFilter(prefix.to_java_bytes) + scan.setStartStopRowForPrefixScan(prefix.to_java_bytes) # Run the scanner to get all rowkeys scanner = @table.getScanner(scan) # Create a list to store all deletes @@ -536,7 +536,7 @@ def _hash_to_scan(args) end # This will overwrite any startrow/stoprow settings - scan.setRowPrefixFilter(rowprefixfilter.to_java_bytes) if rowprefixfilter + scan.setStartStopRowForPrefixScan(rowprefixfilter.to_java_bytes) if rowprefixfilter # Clear converters from last scan. @converters.clear diff --git a/src/main/asciidoc/_chapters/datamodel.adoc b/src/main/asciidoc/_chapters/datamodel.adoc index dd54b1cc04cf..c8164e4696a8 100644 --- a/src/main/asciidoc/_chapters/datamodel.adoc +++ b/src/main/asciidoc/_chapters/datamodel.adoc @@ -300,7 +300,7 @@ Table table = ... // instantiate a Table instance Scan scan = new Scan(); scan.addColumn(CF, ATTR); -scan.setRowPrefixFilter(Bytes.toBytes("row")); +scan.setStartStopRowForPrefixScan(Bytes.toBytes("row")); ResultScanner rs = table.getScanner(scan); try { for (Result r = rs.next(); r != null; r = rs.next()) { From 2f040276ccf9fdd5b8905e80efb3771e09044503 Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Sat, 26 Feb 2022 15:51:45 +0100 Subject: [PATCH 4/5] HBASE-26762: Deprecate setRowPrefixFilter since 2.5.0 Signed-off-by: Niels Basjes --- .../src/main/java/org/apache/hadoop/hbase/client/Scan.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java index 0f8fceea91be..70510f937dbc 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java @@ -433,7 +433,7 @@ public Scan withStopRow(byte[] stopRow, boolean inclusive) { * Such a combination will yield unexpected and even undefined results.

* @param rowPrefix the prefix all rows must start with. (Set null to remove the filter.) * @return this - * @deprecated since 3.0.0. The name of this method is considered to be confusing as it does not + * @deprecated since 2.5.0. The name of this method is considered to be confusing as it does not * use a {@link Filter} but uses setting the startRow and stopRow instead. * Use {@link #setStartStopRowForPrefixScan(byte[])} instead. */ From e8f9a0b24a035527a491488d6b5b0d8e78ca6610 Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Sat, 26 Feb 2022 21:23:07 +0100 Subject: [PATCH 5/5] HBASE-26762: Update javadoc and fix checkstyle issues Signed-off-by: Niels Basjes --- .../src/main/java/org/apache/hadoop/hbase/client/Scan.java | 3 ++- .../java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java | 3 ++- .../java/org/apache/hadoop/hbase/client/TestImmutableScan.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java index 70510f937dbc..dbbc4e6d70ce 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java @@ -433,7 +433,8 @@ public Scan withStopRow(byte[] stopRow, boolean inclusive) { * Such a combination will yield unexpected and even undefined results.

* @param rowPrefix the prefix all rows must start with. (Set null to remove the filter.) * @return this - * @deprecated since 2.5.0. The name of this method is considered to be confusing as it does not + * @deprecated since 2.5.0, will be removed in 4.0.0. + * The name of this method is considered to be confusing as it does not * use a {@link Filter} but uses setting the startRow and stopRow instead. * Use {@link #setStartStopRowForPrefixScan(byte[])} instead. */ diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java index d83b4ec43e38..94b87c4683e4 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaTableUtil.java @@ -637,7 +637,8 @@ static void deleteTableUsageSnapshotsForNamespace(Connection connection, String throws IOException { Scan s = new Scan(); //Get rows for all tables in namespace - s.setStartStopRowForPrefixScan(Bytes.add(QUOTA_TABLE_ROW_KEY_PREFIX, Bytes.toBytes(namespace + TableName.NAMESPACE_DELIM))); + s.setStartStopRowForPrefixScan( + Bytes.add(QUOTA_TABLE_ROW_KEY_PREFIX, Bytes.toBytes(namespace + TableName.NAMESPACE_DELIM))); //Scan for table usage column (u:p) in quota table s.addColumn(QUOTA_FAMILY_USAGE,QUOTA_QUALIFIER_POLICY); //Scan for table quota column (q:s) if table has a space quota defined diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java index f31a50f30d36..7a36696d1544 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestImmutableScan.java @@ -184,7 +184,8 @@ private void testUnmodifiableSetters(Scan scanCopy) throws IOException { scanCopy.setStartStopRowForPrefixScan(new byte[] { 1, 2 }); throw new RuntimeException("Should not reach here"); } catch (UnsupportedOperationException e) { - assertEquals("ImmutableScan does not allow access to setStartStopRowForPrefixScan", e.getMessage()); + assertEquals("ImmutableScan does not allow access to setStartStopRowForPrefixScan", + e.getMessage()); } try { scanCopy.readAllVersions();