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 15:04:05 UTC
[hbase] branch branch-2 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 branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new ddddd2a HBASE-24831 : Addendum for source compatibility
ddddd2a is described below
commit ddddd2a822d33b6d7c4b834a7b229a4deb30a05c
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 821df12..0e3281f 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;
@@ -95,6 +96,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 {@link org.apache.hadoop.hbase.HTableDescriptor} to scan.
@@ -268,6 +290,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