HBASE-3705 Allow passing timestamp into importtsv

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1087586 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-04-01 05:34:51 +00:00
parent 8ae8903ab7
commit 9e6308c918
3 changed files with 7 additions and 2 deletions

View File

@ -116,6 +116,7 @@ Release 0.91.0 - Unreleased
HBaseAdmin methods (David Butler via Stack)
HBASE-3720 Book.xml - porting conceptual-view / physical-view sections of
HBaseArchitecture wiki (Doug Meil via Stack)
HBASE-3705 Allow passing timestamp into importtsv (Andy Sautins via Stack)
TASK
HBASE-3559 Move report of split to master OFF the heartbeat channel

View File

@ -63,6 +63,7 @@ public class ImportTsv {
final static String BULK_OUTPUT_CONF_KEY = "importtsv.bulk.output";
final static String COLUMNS_CONF_KEY = "importtsv.columns";
final static String SEPARATOR_CONF_KEY = "importtsv.separator";
final static String TIMESTAMP_CONF_KEY = "importtsv.timestamp";
final static String DEFAULT_SEPARATOR = "\t";
static class TsvParser {
@ -220,7 +221,7 @@ public class ImportTsv {
if (parser.getRowKeyColumnIndex() == -1) {
throw new RuntimeException("No row key column specified");
}
ts = System.currentTimeMillis();
ts = conf.getLong(TIMESTAMP_CONF_KEY, System.currentTimeMillis());
skipBadLines = context.getConfiguration().getBoolean(
SKIP_LINES_CONF_KEY, true);
@ -356,7 +357,9 @@ public class ImportTsv {
"\n" +
"Other options that may be specified with -D include:\n" +
" -D" + SKIP_LINES_CONF_KEY + "=false - fail if encountering an invalid line\n" +
" '-D" + SEPARATOR_CONF_KEY + "=|' - eg separate on pipes instead of tabs";
" '-D" + SEPARATOR_CONF_KEY + "=|' - eg separate on pipes instead of tabs\n" +
" -D" + TIMESTAMP_CONF_KEY + "=currentTimeAsLong - use the specified timestamp for the import\n";
System.err.println(usage);
}

View File

@ -105,6 +105,7 @@ In order to prepare data for a bulk data load, pass the option:
Other options that may be specified with -D include:
-Dimporttsv.skip.bad.lines=false - fail if encountering an invalid line
-Dimporttsv.timestamp=currentTimeAsLong - use the specified timestamp for the import
</pre></code>
</section>
<section name="Importing the prepared data using the completebulkload tool">