throw new VoltAbortException(msg);
}
MarkovEstimator t_estimator = (MarkovEstimator)this.executor.getTransactionEstimator();
assert(t_estimator != null);
MarkovGraphsContainer markovs = t_estimator.getMarkovGraphsContainer();
if (t_estimator.getMarkovGraphsContainer() != null) {
boolean is_global = t_estimator.getMarkovGraphsContainer().isGlobal();
// We will only write out our file if we are the first partition in the list at this site
if (is_global == false || (is_global == true && isFirstLocalPartition())) {
if (debug.val) LOG.debug(String.format("Recalculating MarkovGraph probabilities at partition %d [save=%s, global=%s]",
this.partitionId, save_to_file, is_global));
int ctr = 0;
for (MarkovGraph m : markovs.getAll()) {
try {
m.calculateProbabilities(this.catalogContext.getAllPartitionIds());
} catch (Throwable ex) {
LOG.fatal(String.format("Failed to recalculate probabilities for %s MarkovGraph #%d: %s", m.getProcedure().getName(), m.getGraphId(), ex.getMessage()));
File output = MarkovUtil.exportGraphviz(m, true, false, true, null).writeToTempFile();
LOG.fatal("Wrote out invalid MarkovGraph: " + output.getAbsolutePath());
this.executor.crash(ex);
assert(false) : "I shouldn't have gotten here!";
}
ctr++;
} // FOR
if (debug.val) LOG.debug(String.format("Recalculated %d MarkovGraph probabilities at partition %d", ctr, this.partitionId));
File f = null;
if (save_to_file) {
File dir = new File(hstore_conf.global.temp_dir);
f = FileUtil.getTempFile(dir, "markovs-" + this.partitionId, true);
LOG.info(String.format("Saving updated MarkovGraphs to '" + f + "'"));
try {
markovs.save(f);
} catch (Throwable ex) {
throw new RuntimeException("Failed to save MarkovGraphContainer for site " + HStoreThreadManager.formatSiteName(this.executor.getSiteId()), ex);
}
}
result[0].addRow(