Skip to content

Commit 325317f

Browse files
committed
HBASE-24831 : Addendum for source compatibility
Closes #2403 Signed-off-by: Nick Dimiduk <[email protected]>
1 parent a3f4028 commit 325317f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReaderImpl.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.hadoop.hbase.mapreduce;
1919

2020
import java.io.IOException;
21+
import java.lang.reflect.Method;
2122
import java.util.Map;
2223
import org.apache.hadoop.conf.Configuration;
2324
import org.apache.hadoop.hbase.DoNotRetryIOException;
@@ -95,6 +96,27 @@ public void restart(byte[] firstRow) throws IOException {
9596
}
9697
}
9798

99+
/**
100+
* In new mapreduce APIs, TaskAttemptContext has two getCounter methods
101+
* Check if getCounter(String, String) method is available.
102+
* @return The getCounter method or null if not available.
103+
* @deprecated since 2.4.0 and 2.3.2, will be removed in 4.0.0
104+
*/
105+
@Deprecated
106+
protected static Method retrieveGetCounterWithStringsParams(TaskAttemptContext context)
107+
throws IOException {
108+
Method m = null;
109+
try {
110+
m = context.getClass().getMethod("getCounter",
111+
new Class [] {String.class, String.class});
112+
} catch (SecurityException e) {
113+
throw new IOException("Failed test for getCounter", e);
114+
} catch (NoSuchMethodException e) {
115+
// Ignore
116+
}
117+
return m;
118+
}
119+
98120
/**
99121
* Sets the HBase table.
100122
* @param htable The table to scan.
@@ -267,6 +289,16 @@ private void updateCounters() {
267289
updateCounters(scanMetrics, numRestarts, context, numStale);
268290
}
269291

292+
/**
293+
* @deprecated since 2.4.0 and 2.3.2, will be removed in 4.0.0
294+
* Use {@link #updateCounters(ScanMetrics, long, TaskAttemptContext, long)} instead.
295+
*/
296+
@Deprecated
297+
protected static void updateCounters(ScanMetrics scanMetrics, long numScannerRestarts,
298+
Method getCounter, TaskAttemptContext context, long numStale) {
299+
updateCounters(scanMetrics, numScannerRestarts, context, numStale);
300+
}
301+
270302
protected static void updateCounters(ScanMetrics scanMetrics, long numScannerRestarts,
271303
TaskAttemptContext context, long numStale) {
272304
// we can get access to counters only if hbase uses new mapreduce APIs

0 commit comments

Comments
 (0)