HBASE-12375 LoadIncrementalHFiles fails to load data in table when CF name starts with '_'
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
8b84840d5a
commit
87939889bb
|
@ -203,8 +203,6 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
|||
continue;
|
||||
}
|
||||
Path familyDir = stat.getPath();
|
||||
// Skip _logs, etc
|
||||
if (familyDir.getName().startsWith("_")) continue;
|
||||
byte[] family = familyDir.getName().getBytes();
|
||||
Path[] hfiles = FileUtil.stat2Paths(fs.listStatus(familyDir));
|
||||
for (Path hfile : hfiles) {
|
||||
|
@ -850,8 +848,6 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
|||
continue;
|
||||
}
|
||||
Path familyDir = stat.getPath();
|
||||
// Skip _logs, etc
|
||||
if (familyDir.getName().startsWith("_")) continue;
|
||||
byte[] family = familyDir.getName().getBytes();
|
||||
|
||||
hcd = new HColumnDescriptor(family);
|
||||
|
|
|
@ -432,5 +432,33 @@ public class TestLoadIncrementalHFiles {
|
|||
String[] args = { "directory", "nonExistingTable" };
|
||||
loader.run(args);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTableWithCFNameStartWithUnderScore() throws Exception {
|
||||
Path dir = util.getDataTestDirOnTestFS("cfNameStartWithUnderScore");
|
||||
FileSystem fs = util.getTestFileSystem();
|
||||
dir = dir.makeQualified(fs.getUri(), fs.getWorkingDirectory());
|
||||
String family = "_cf";
|
||||
Path familyDir = new Path(dir, family);
|
||||
|
||||
byte[] from = Bytes.toBytes("begin");
|
||||
byte[] to = Bytes.toBytes("end");
|
||||
Configuration conf = util.getConfiguration();
|
||||
String tableName = "mytable_cfNameStartWithUnderScore";
|
||||
Table table = util.createTable(TableName.valueOf(tableName), family);
|
||||
HFileTestUtil.createHFile(conf, fs, new Path(familyDir, "hfile"), Bytes.toBytes(family),
|
||||
QUALIFIER, from, to, 1000);
|
||||
|
||||
LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf);
|
||||
String[] args = { dir.toString(), tableName };
|
||||
try {
|
||||
loader.run(args);
|
||||
assertEquals(1000, util.countRows(table));
|
||||
} finally {
|
||||
if (null != table) {
|
||||
table.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue