Repository: hbase Updated Branches: refs/heads/master 1713f1fca -> c220635c7
HBASE-13352 Add hbase.import.version to Import usage (Lars Hofhansl) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c220635c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c220635c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c220635c Branch: refs/heads/master Commit: c220635c7893c96db675cb2b80af6ade4a44e3d4 Parents: 1713f1f Author: Enis Soztutar <e...@apache.org> Authored: Mon Jul 6 15:39:19 2015 -0700 Committer: Enis Soztutar <e...@apache.org> Committed: Mon Jul 6 15:39:19 2015 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/mapreduce/Import.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/c220635c/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java index 92efd27..1fe5d56 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/Import.java @@ -48,6 +48,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.hadoop.mapreduce.Job; +import org.apache.hadoop.mapreduce.TaskCounter; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; @@ -502,7 +503,9 @@ public class Import extends Configured implements Tool { + " Filter#filterKeyValue(KeyValue) method to determine if the KeyValue should be added;" + " Filter.ReturnCode#INCLUDE and #INCLUDE_AND_NEXT_COL will be considered as including" + " the KeyValue."); - System.err.println(" -D " + JOB_NAME_CONF_KEY + System.err.println("To import data exported from HBase 0.94, use"); + System.err.println(" -Dhbase.import.version=0.94"); + System.err.println(" -D " + JOB_NAME_CONF_KEY + "=jobName - use the specified mapreduce job name for the import"); System.err.println("For performance consider the following options:\n" + " -Dmapreduce.map.speculative=false\n" @@ -559,6 +562,16 @@ public class Import extends Configured implements Tool { // Flush all the regions of the table flushRegionsIfNecessary(getConf()); } + long inputRecords = job.getCounters().findCounter(TaskCounter.MAP_INPUT_RECORDS).getValue(); + long outputRecords = job.getCounters().findCounter(TaskCounter.MAP_OUTPUT_RECORDS).getValue(); + if (outputRecords < inputRecords) { + System.err.println("Warning, not all records were imported (maybe filtered out)."); + if (outputRecords == 0) { + System.err.println("If the data was exported from HBase 0.94 "+ + "consider using -Dhbase.import.version=0.94."); + } + } + return (isJobSuccessful ? 0 : 1); }