}
@Override
public void commitJob(JobContext jobContext) throws IOException {
baseOutputCommitter.commitJob(jobContext);
RevisionManager rm = null;
try {
Configuration conf = jobContext.getConfiguration();
Path srcPath = FileOutputFormat.getOutputPath(jobContext.getJobConf());
if (!FileSystem.get(conf).exists(srcPath)) {
throw new IOException("Failed to bulk import hfiles. " +
"Intermediate data directory is cleaned up or missing. " +
"Please look at the bulk import job if it exists for failure reason");
}
Path destPath = new Path(srcPath.getParent(), srcPath.getName() + "_hfiles");
boolean success = ImportSequenceFile.runJob(jobContext,
conf.get(HBaseConstants.PROPERTY_OUTPUT_TABLE_NAME_KEY),
srcPath,
destPath);
if (!success) {
cleanIntermediate(jobContext);
throw new IOException("Failed to bulk import hfiles." +
" Please look at the bulk import job for failure reason");
}
rm = HBaseRevisionManagerUtil.getOpenedRevisionManager(conf);
rm.commitWriteTransaction(HBaseRevisionManagerUtil.getWriteTransaction(conf));
cleanIntermediate(jobContext);
} finally {
if (rm != null)
rm.close();
}
}