int partition_id = context.getPartitionExecutor().getPartitionId();
LOG.trace("Starting performLoadPartitionedTable " + tableName + " at partition - " + partition_id);
String result_str = "SUCCESS";
String error_msg = "";
TableSaveFile savefile = null;
/**
* For partitioned tables
*/
try {
savefile = getTableSaveFile(getSaveFileForPartitionedTable(m_filePath, m_fileNonce, tableName,
catalog_host.getId(),
catalog_site.getId(),
catalog_partition.getId()),
3, null);
assert (savefile.getCompleted());
} catch (IOException e) {
VoltTable result = constructResultsTable();
result.addRow(m_hostId, hostname, m_siteId, tableName, -1, "FAILURE", "Unable to load table: " + tableName + " error: " + e.getMessage());
return result;
}
try {
while (savefile.hasMoreChunks()) {
VoltTable table = null;
final org.voltdb.utils.DBBPool.BBContainer c = savefile.getNextChunk();
if (c == null) {
continue; // Should be equivalent to break
}
VoltTable old_table = PrivateVoltTableFactory.createVoltTableFromBuffer(c.b, true);
Table new_catalog_table = getCatalogTable(tableName);
table = SavedTableConverter.convertTable(old_table, new_catalog_table);
c.discard();
try {
LOG.trace("LoadTable " + tableName);
this.executor.loadTable(ts, context.getCluster().getTypeName(), context.getDatabase().getTypeName(), tableName, table, allowExport);
} catch (VoltAbortException e) {
result_str = "FAILURE";
error_msg = e.getMessage();
break;
}
}
} catch (Exception e) {
VoltTable result = constructResultsTable();
result.addRow(m_hostId, hostname, m_siteId, tableName, -1, "FAILURE", "Unable to load table: " + tableName + " error: " + e.getMessage());
return result;
}
VoltTable result = constructResultsTable();
result.addRow(m_hostId, hostname, m_siteId, tableName, -1, result_str, error_msg);
try {
savefile.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}