HBASE-24831 : Addendum for source compatibility
Closes #2403 Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
This commit is contained in:
parent
3cb4b29fa3
commit
ddddd2a822
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.hadoop.hbase.mapreduce;
|
package org.apache.hadoop.hbase.mapreduce;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
||||||
|
@ -94,6 +95,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.
|
* Sets the HBase table.
|
||||||
*
|
*
|
||||||
|
@ -268,6 +290,16 @@ public class TableRecordReaderImpl {
|
||||||
updateCounters(scanMetrics, numRestarts, context, numStale);
|
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,
|
protected static void updateCounters(ScanMetrics scanMetrics, long numScannerRestarts,
|
||||||
TaskAttemptContext context, long numStale) {
|
TaskAttemptContext context, long numStale) {
|
||||||
// we can get access to counters only if hbase uses new mapreduce APIs
|
// we can get access to counters only if hbase uses new mapreduce APIs
|
||||||
|
|
Loading…
Reference in New Issue