* @param paths A reference to the <paths> element of the deployment.xml file.
* @param printLog Whether or not to print paths info.
*/
private static void setPathsInfo(Catalog catalog, PathsType paths, boolean crashOnFailedValidation) {
File voltDbRoot;
final Cluster cluster = catalog.getClusters().get("cluster");
// Handles default voltdbroot (and completely missing "paths" element).
voltDbRoot = getVoltDbRoot(paths);
validateDirectory("volt root", voltDbRoot, crashOnFailedValidation);
PathEntry path_entry = null;
if (paths != null)
{
path_entry = paths.getSnapshots();
}
File snapshotPath =
getFeaturePath(paths, path_entry, voltDbRoot,
"snapshot", "snapshots");
validateDirectory("snapshot path", snapshotPath, crashOnFailedValidation);
path_entry = null;
if (paths != null)
{
path_entry = paths.getExportoverflow();
}
File exportOverflowPath =
getFeaturePath(paths, path_entry, voltDbRoot, "export overflow",
"export_overflow");
validateDirectory("export overflow", exportOverflowPath, crashOnFailedValidation);
// only use these directories in the enterprise version
File commandLogPath = null;
File commandLogSnapshotPath = null;
path_entry = null;
if (paths != null)
{
path_entry = paths.getCommandlog();
}
if (VoltDB.instance().getConfig().m_isEnterprise) {
commandLogPath =
getFeaturePath(paths, path_entry, voltDbRoot, "command log", "command_log");
validateDirectory("command log", commandLogPath, crashOnFailedValidation);
}
else {
// dumb defaults if you ask for logging in community version
commandLogPath = new VoltFile(voltDbRoot, "command_log");
}
path_entry = null;
if (paths != null)
{
path_entry = paths.getCommandlogsnapshot();
}
if (VoltDB.instance().getConfig().m_isEnterprise) {
commandLogSnapshotPath =
getFeaturePath(paths, path_entry, voltDbRoot, "command log snapshot", "command_log_snapshot");
validateDirectory("command log snapshot", commandLogSnapshotPath, crashOnFailedValidation);
}
else {
// dumb defaults if you ask for logging in community version
commandLogSnapshotPath = new VoltFile(voltDbRoot, "command_log_snapshot");;
}
//Set the volt root in the catalog
catalog.getClusters().get("cluster").setVoltroot(voltDbRoot.getPath());
//Set the auto-snapshot schedule path if there are auto-snapshots
SnapshotSchedule schedule = cluster.getDatabases().
get("database").getSnapshotschedule().get("default");
if (schedule != null) {
schedule.setPath(snapshotPath.getPath());
}
//Update the path in the schedule for ppd
schedule = cluster.getFaultsnapshots().get("CLUSTER_PARTITION");
if (schedule != null) {
schedule.setPath(snapshotPath.getPath());
}
//Also set the export overflow directory
cluster.setExportoverflow(exportOverflowPath.getPath());
//Set the command log paths, also creates the command log entry in the catalog
final org.voltdb.catalog.CommandLog commandLogConfig = cluster.getLogconfig().add("log");
commandLogConfig.setInternalsnapshotpath(commandLogSnapshotPath.getPath());
commandLogConfig.setLogpath(commandLogPath.getPath());
}