HBASE-1215 fix for fact that we only run one map
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@796953 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
467e48e4b1
commit
8779790735
|
@ -69,17 +69,15 @@ public class HStoreFileToStoreFile {
|
|||
if (fs.exists(dir)) {
|
||||
throw new IOException("Input exists -- please specify empty input dir");
|
||||
}
|
||||
FSDataOutputStream out = fs.create(new Path(dir, "mapfiles"));
|
||||
try {
|
||||
gathermapfiles(conf, fs, out);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
gathermapfiles(conf, fs, dir);
|
||||
}
|
||||
|
||||
private static void gathermapfiles(final HBaseConfiguration conf,
|
||||
final FileSystem fs, final FSDataOutputStream out)
|
||||
final FileSystem fs, final Path dir)
|
||||
throws IOException {
|
||||
int index = 0;
|
||||
FSDataOutputStream out = getOut(fs, dir, index, null);
|
||||
try {
|
||||
// Presumes any directory under hbase.rootdir is a table.
|
||||
FileStatus [] tableDirs =
|
||||
fs.listStatus(FSUtils.getRootDir(conf), new DirFilter(fs));
|
||||
|
@ -128,12 +126,27 @@ public class HStoreFileToStoreFile {
|
|||
String str = familyStatus[0].getPath().makeQualified(fs).toString();
|
||||
LOG.info(str);
|
||||
out.write(Bytes.toBytes(str + "\n"));
|
||||
if (index++ % 100 == 0) {
|
||||
if (index != 0) {
|
||||
out = getOut(fs, dir, index, out);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG.warn("Empty store " + family.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static FSDataOutputStream getOut(final FileSystem fs, final Path dir,
|
||||
final int index, FSDataOutputStream out)
|
||||
throws IOException {
|
||||
if (out == null) out.close();
|
||||
return fs.create(new Path(dir, "mapfiles-" + index));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue