VoltTable[] restore_results = new VoltTable[1];
restore_results[0] = constructResultsTable();
ArrayList<SynthesizedPlanFragment[]> restorePlans = new ArrayList<SynthesizedPlanFragment[]>();
for (Table t : tables_to_restore) {
TableSaveFileState table_state = savefileState.getTableState(t.getTypeName());
SynthesizedPlanFragment[] restore_plan = table_state.generateRestorePlan(t);
if (restore_plan == null) {
LOG.error("Unable to generate restore plan for " + t.getTypeName() + " table not restored");
throw new VoltAbortException("Unable to generate restore plan for " + t.getTypeName() + " table not restored");
}
restorePlans.add(restore_plan);
}
Iterator<Table> tableIterator = tables_to_restore.iterator();
for (SynthesizedPlanFragment[] restore_plan : restorePlans) {
Table table = tableIterator.next();
TableSaveFileState table_state = savefileState.getTableState(table.getTypeName());
LOG.trace("Performing restore for table: " + table.getTypeName());
// LOG.trace("Plan has fragments: " + restore_plan.length);
VoltTable[] results = executeSysProcPlanFragments(restore_plan, table_state.getRootDependencyId());
while (results[0].advanceRow()) {
// this will actually add the active row of results[0]
restore_results[0].add(results[0]);
}
}