-1, f.canRead() ? "TRUE" : "FALSE", "SUCCESS", "");
}
}
}
}
return new DependencySet(DEP_snapshotScan, results);
} else if (fragmentId == SysProcFragmentId.PF_snapshotScanResults) {
final VoltTable results = constructFragmentResultsTable();
LOG.trace("Aggregating Snapshot Scan results");
assert (dependencies.size() > 0);
List<VoltTable> dep = dependencies.get(DEP_snapshotScan);
for (VoltTable table : dep) {
while (table.advanceRow()) {
// this will add the active row of table
results.add(table);
}
}
return new DependencySet(DEP_snapshotScanResults, results);
} else if (fragmentId == SysProcFragmentId.PF_snapshotDigestScan) {
final VoltTable results = constructDigestResultsTable();
// Choose the lowest site ID on this host to do the file scan
// All other sites should just return empty results tables.
int host_id = context.getHStoreSite().getHostId();
Integer lowest_site_id = null; // FIXME
// VoltDB.instance().getCatalogContext().siteTracker.
// getLowestLiveExecSiteIdForHost(host_id);
if (context.getPartitionExecutor().getSiteId() == lowest_site_id) {
assert (params.toArray()[0] != null);
assert (params.toArray()[0] instanceof String);
final String path = (String) params.toArray()[0];
List<File> relevantFiles = retrieveRelevantFiles(path);
if (relevantFiles == null) {
results.addRow(Integer.parseInt(context.getSite().getHost().getTypeName().replaceAll("[\\D]", "")), "", "", "", "FAILURE", errorString);
} else {
for (final File f : relevantFiles) {
if (f.getName().endsWith(".vpt")) {
continue;
}
if (f.canRead()) {
try {
List<String> tableNames = SnapshotUtil.retrieveRelevantTableNamesAndTime(f).getSecond();
final StringWriter sw = new StringWriter();
for (int ii = 0; ii < tableNames.size(); ii++) {
sw.append(tableNames.get(ii));
if (ii != tableNames.size() - 1) {
sw.append(',');
}
}
results.addRow(Integer.parseInt(context.getSite().getHost().getTypeName().replaceAll("[\\D]", "")), path, f.getName(), sw.toString(), "SUCCESS", "");
} catch (Exception e) {
LOG.warn(e);
}
}
}
}
}
return new DependencySet(DEP_snapshotDigestScan, results);
} else if (fragmentId == SysProcFragmentId.PF_snapshotDigestScanResults) {
final VoltTable results = constructDigestResultsTable();
LOG.trace("Aggregating Snapshot Digest Scan results");
assert (dependencies.size() > 0);
List<VoltTable> dep = dependencies.get(DEP_snapshotDigestScan);
for (VoltTable table : dep) {
while (table.advanceRow()) {
// this will add the active row of table
results.add(table);
}
}
return new DependencySet(DEP_snapshotDigestScanResults, results);
} else if (fragmentId == SysProcFragmentId.PF_hostDiskFreeScan) {
final VoltTable results = constructDiskFreeResultsTable();
// Choose the lowest site ID on this host to do the file scan
// All other sites should just return empty results tables.
int host_id = context.getHStoreSite().getHostId();
Integer lowest_site_id = null; // FIXME
// VoltDB.instance().getCatalogContext().siteTracker.
// getLowestLiveExecSiteIdForHost(host_id);
if (context.getPartitionExecutor().getSiteId() == lowest_site_id) {
assert (params.toArray()[0] != null);
assert (params.toArray()[0] instanceof String);
final String path = (String) params.toArray()[0];
File dir = new File(path);
if (dir.isDirectory()) {
final long free = dir.getUsableSpace();
final long total = dir.getTotalSpace();
final long used = total - free;
results.addRow(Integer.parseInt(context.getSite().getHost().getTypeName().replaceAll("[\\D]", "")), hostname, path, total, free, used, "SUCCESS", "");
} else {
results.addRow(Integer.parseInt(context.getSite().getHost().getTypeName().replaceAll("[\\D]", "")), hostname, path, 0, 0, 0, "FAILURE", "Path is not a directory");
}
}
return new DependencySet(DEP_hostDiskFreeScan, results);
} else if (fragmentId == SysProcFragmentId.PF_hostDiskFreeScanResults) {
final VoltTable results = constructDiskFreeResultsTable();
LOG.trace("Aggregating disk free results");
assert (dependencies.size() > 0);
List<VoltTable> dep = dependencies.get(DEP_hostDiskFreeScan);
for (VoltTable table : dep) {
while (table.advanceRow()) {
// this will add the active row of table
results.add(table);
}
}
return new DependencySet(DEP_hostDiskFreeScanResults, results);
}
assert (false);
return null;
}