@Test public void testLoadTooMayHFiles() throws Exception { Path dir = util.getDataTestDirOnTestFS("testLoadTooMayHFiles"); FileSystem fs = util.getTestFileSystem(); dir = dir.makeQualified(fs); Path familyDir = new Path(dir, Bytes.toString(FAMILY)); byte[] from = Bytes.toBytes("begin"); byte[] to = Bytes.toBytes("end"); for (int i = 0; i <= MAX_FILES_PER_REGION_PER_FAMILY; i++) { HFileTestUtil.createHFile(util.getConfiguration(), fs, new Path(familyDir, "hfile_" + i), FAMILY, QUALIFIER, from, to, 1000); } LoadIncrementalHFiles loader = new LoadIncrementalHFiles(util.getConfiguration()); String [] args= {dir.toString(), "mytable_testLoadTooMayHFiles"}; try { loader.run(args); fail("Bulk loading too many files should fail"); } catch (IOException ie) { assertTrue(ie.getMessage().contains("Trying to load more than " + MAX_FILES_PER_REGION_PER_FAMILY + " hfiles")); } }
@Override public int run(String[] args) throws Exception { if (args.length != 2) { usage(); return -1; } String dirPath = args[0]; TableName tableName = TableName.valueOf(args[1]); boolean tableExists = this.doesTableExist(tableName); if (!tableExists) this.createTable(tableName,dirPath); Path hfofDir = new Path(dirPath); HTable table = new HTable(getConf(), tableName); doBulkLoad(hfofDir, table); return 0; }
LoadIncrementalHFiles extends Configured implements Tool { @Override public int run(String[] args) throws Exception { if (args.length != 2) { usage(); return -1; } String dirPath = args[0]; TableName tableName = TableName.valueOf(args[1]); boolean tableExists = this.doesTableExist(tableName); if (!tableExists) this.createTable(tableName,dirPath); Path hfofDir = new Path(dirPath); HTable table = new HTable(getConf(), tableName); doBulkLoad(hfofDir, table); return 0; } }
LoadIncrementalHFiles extends Configured implements Tool { @Override public int run(String[] args) throws Exception { if (args.length != 2) { usage(); return -1; } String dirPath = args[0]; TableName tableName = TableName.valueOf(args[1]); boolean tableExists = this.doesTableExist(tableName); if (!tableExists) this.createTable(tableName,dirPath); Path hfofDir = new Path(dirPath); HTable table = new HTable(getConf(), tableName); doBulkLoad(hfofDir, table); return 0; } LoadIncrementalHFiles(Configuration conf); }
LoadIncrementalHFiles extends Configured implements Tool { @Override public int run(String[] args) throws Exception { if (args.length != 2) { usage(); return -1; } String dirPath = args[0]; TableName tableName = TableName.valueOf(args[1]); boolean tableExists = this.doesTableExist(tableName); if (!tableExists) this.createTable(tableName,dirPath); Path hfofDir = new Path(dirPath); HTable table = new HTable(getConf(), tableName); doBulkLoad(hfofDir, table); return 0; } LoadIncrementalHFiles(Configuration conf); @SuppressWarnings("deprecation") void doBulkLoad(Path hfofDir, final HTable table); static byte[][] inferBoundaries(TreeMap<byte[], Integer> bdryMap); @Override int run(String[] args); static void main(String[] args); }
LoadIncrementalHFiles extends Configured implements Tool { @Override public int run(String[] args) throws Exception { if (args.length != 2) { usage(); return -1; } String dirPath = args[0]; TableName tableName = TableName.valueOf(args[1]); boolean tableExists = this.doesTableExist(tableName); if (!tableExists) this.createTable(tableName,dirPath); Path hfofDir = new Path(dirPath); HTable table = new HTable(getConf(), tableName); doBulkLoad(hfofDir, table); return 0; } LoadIncrementalHFiles(Configuration conf); @SuppressWarnings("deprecation") void doBulkLoad(Path hfofDir, final HTable table); static byte[][] inferBoundaries(TreeMap<byte[], Integer> bdryMap); @Override int run(String[] args); static void main(String[] args); static final String NAME; static final String MAX_FILES_PER_REGION_PER_FAMILY; }