You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2020/09/15 14:50:04 UTC
[hbase] branch master updated: HBASE-24831 : Addendum for source
compatibility
This is an automated email from the ASF dual-hosted git repository.
vjasani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new 325317f HBASE-24831 : Addendum for source compatibility
325317f is described below
commit 325317ff9ef0168f37e47f506a8947701e1919a4
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Tue Sep 15 20:10:50 2020 +0530
HBASE-24831 : Addendum for source compatibility
Closes #2403
Signed-off-by: Nick Dimiduk <nd...@apache.org>
---
.../hbase/mapreduce/TableRecordReaderImpl.java | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
index 5242bd9..c84b25b 100644
--- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
+++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.mapreduce;
import java.io.IOException;
+import java.lang.reflect.Method;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.DoNotRetryIOException;
@@ -96,6 +97,27 @@ public class TableRecordReaderImpl {
}
/**
+ * In new mapreduce APIs, TaskAttemptContext has two getCounter methods
+ * Check if getCounter(String, String) method is available.
+ * @return The getCounter method or null if not available.
+ * @deprecated since 2.4.0 and 2.3.2, will be removed in 4.0.0
+ */
+ @Deprecated
+ protected static Method retrieveGetCounterWithStringsParams(TaskAttemptContext context)
+ throws IOException {
+ Method m = null;
+ try {
+ m = context.getClass().getMethod("getCounter",
+ new Class [] {String.class, String.class});
+ } catch (SecurityException e) {
+ throw new IOException("Failed test for getCounter", e);
+ } catch (NoSuchMethodException e) {
+ // Ignore
+ }
+ return m;
+ }
+
+ /**
* Sets the HBase table.
* @param htable The table to scan.
*/
@@ -267,6 +289,16 @@ public class TableRecordReaderImpl {
updateCounters(scanMetrics, numRestarts, context, numStale);
}
+ /**
+ * @deprecated since 2.4.0 and 2.3.2, will be removed in 4.0.0
+ * Use {@link #updateCounters(ScanMetrics, long, TaskAttemptContext, long)} instead.
+ */
+ @Deprecated
+ protected static void updateCounters(ScanMetrics scanMetrics, long numScannerRestarts,
+ Method getCounter, TaskAttemptContext context, long numStale) {
+ updateCounters(scanMetrics, numScannerRestarts, context, numStale);
+ }
+
protected static void updateCounters(ScanMetrics scanMetrics, long numScannerRestarts,
TaskAttemptContext context, long numStale) {
// we can get access to counters only if hbase uses new mapreduce APIs