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
c466c61976
commit
d8874fbc21
|
@ -203,8 +203,6 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Path familyDir = stat.getPath();
|
Path familyDir = stat.getPath();
|
||||||
// Skip _logs, etc
|
|
||||||
if (familyDir.getName().startsWith("_")) continue;
|
|
||||||
byte[] family = familyDir.getName().getBytes();
|
byte[] family = familyDir.getName().getBytes();
|
||||||
Path[] hfiles = FileUtil.stat2Paths(fs.listStatus(familyDir));
|
Path[] hfiles = FileUtil.stat2Paths(fs.listStatus(familyDir));
|
||||||
for (Path hfile : hfiles) {
|
for (Path hfile : hfiles) {
|
||||||
|
@ -850,8 +848,6 @@ public class LoadIncrementalHFiles extends Configured implements Tool {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Path familyDir = stat.getPath();
|
Path familyDir = stat.getPath();
|
||||||
// Skip _logs, etc
|
|
||||||
if (familyDir.getName().startsWith("_")) continue;
|
|
||||||
byte[] family = familyDir.getName().getBytes();
|
byte[] family = familyDir.getName().getBytes();
|
||||||
|
|
||||||
hcd = new HColumnDescriptor(family);
|
hcd = new HColumnDescriptor(family);
|
||||||
|
|
|
@ -431,5 +431,33 @@ public class TestLoadIncrementalHFiles {
|
||||||
String[] args = { "directory", "nonExistingTable" };
|
String[] args = { "directory", "nonExistingTable" };
|
||||||
loader.run(args);
|
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