本文整理汇总了Java中org.voltdb.utils.CatalogUtil.loadCatalogFromJar方法的典型用法代码示例。如果您正苦于以下问题:Java CatalogUtil.loadCatalogFromJar方法的具体用法?Java CatalogUtil.loadCatalogFromJar怎么用?Java CatalogUtil.loadCatalogFromJar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.utils.CatalogUtil
的用法示例。
在下文中一共展示了CatalogUtil.loadCatalogFromJar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSaveRestoreSchemaCatalog
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
public Catalog createSaveRestoreSchemaCatalog() throws IOException {
String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
String catalogJar = testDir + File.separator + "saverestore-jni.jar";
addDefaultSchema();
addDefaultPartitioning();
addDefaultProcedures();
addStmtProcedure("JumboInsert", "INSERT INTO JUMBO_ROW VALUES ( ?, ?, ?)", "JUMBO_ROW.PKEY: 0");
addStmtProcedure("JumboSelect", "SELECT * FROM JUMBO_ROW WHERE PKEY = ?", "JUMBO_ROW.PKEY: 0");
addStmtProcedure("JumboCount", "SELECT COUNT(*) FROM JUMBO_ROW");
boolean status = compile(catalogJar);
assert (status);
// read in the catalog
String serializedCatalog = CatalogUtil.loadCatalogFromJar(catalogJar, null);
assert (serializedCatalog != null);
// create the catalog (that will be passed to the ClientInterface
Catalog catalog = new Catalog();
catalog.execute(serializedCatalog);
return catalog;
}
示例2: createTPCCSchemaCatalog
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
public Catalog createTPCCSchemaCatalog(boolean fkeys) throws IOException {
// compile a catalog
String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
String catalogJar = testDir + File.separator + this.getJarName(true);
addSchema(this.getDDLURL(fkeys));
addDefaultPartitioning();
addDefaultProcedures();
//this.addProcedures(org.voltdb.benchmark.tpcc.procedures.InsertHistory.class);
boolean status = compile(catalogJar);
assert(status);
// read in the catalog
String serializedCatalog = CatalogUtil.loadCatalogFromJar(catalogJar, null);
assert(serializedCatalog != null);
// create the catalog (that will be passed to the ClientInterface
Catalog catalog = new Catalog();
catalog.execute(serializedCatalog);
return catalog;
}
示例3: catalogForJar
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
protected Catalog catalogForJar(String pathToJar) {
String serializedCatalog = CatalogUtil.loadCatalogFromJar(pathToJar, null);
assertNotNull(serializedCatalog);
Catalog c = new Catalog();
c.execute(serializedCatalog);
return c;
}
示例4: prepareApplicationCatalogDiff
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
private AsyncCompilerResult prepareApplicationCatalogDiff(CatalogChangeWork work) {
// create the change result and set up all the boiler plate
CatalogChangeResult retval = new CatalogChangeResult();
// retval.clientData = work.clientData;
retval.clientHandle = work.clientHandle;
// retval.connectionId = work.connectionId;
// retval.hostname = work.hostname;
// catalog change specific boiler plate
retval.catalogURL = work.catalogURL;
// get the diff between catalogs
try {
// try to get the new catalog from the params
String newCatalogCommands = CatalogUtil.loadCatalogFromJar(work.catalogURL, null);
if (newCatalogCommands == null) {
retval.errorMsg = "Unable to read from catalog at: " + work.catalogURL;
return retval;
}
Catalog newCatalog = new Catalog();
newCatalog.execute(newCatalogCommands);
// get the current catalog
CatalogContext context = VoltDB.instance().getCatalogContext();
// store the version of the catalog the diffs were created against.
// verified when / if the update procedure runs in order to verify
// catalogs only move forward
retval.expectedCatalogVersion = context.catalog.getCatalogVersion();
// compute the diff in StringBuilder
CatalogDiffEngine diff = new CatalogDiffEngine(context.catalog, newCatalog);
if (!diff.supported()) {
throw new Exception("The requested catalog change is not a supported change at this time. " + diff.errors());
}
// since diff commands can be stupidly big, compress them here
retval.encodedDiffCommands = Encoder.compressAndBase64Encode(diff.commands());
// check if the resulting string is small enough to fit in our parameter sets (about 2mb)
if (retval.encodedDiffCommands.length() > (2 * 1000 * 1000)) {
throw new Exception("The requested catalog change is too large for this version of VoltDB. " +
"Try a series of smaller updates.");
}
}
catch (Exception e) {
e.printStackTrace();
retval.encodedDiffCommands = null;
retval.errorMsg = e.getMessage();
}
return retval;
}
示例5: testSimple
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
public void testSimple() {
TPCCProjectBuilder builder = new TPCCProjectBuilder();
builder.addAllDefaults();
builder.compile("tpcc-oop.jar");
String serializedCatalog = CatalogUtil.loadCatalogFromJar("tpcc-oop.jar", null);
m_pt = PlannerTool.createPlannerToolProcess(serializedCatalog);
PlannerKillerThread ptKiller = new PlannerKillerThread();
ptKiller.m_serializedCatalog = serializedCatalog;
ptKiller.start();
PlannerTool.Result result = null;
result = m_pt.planSql("select * from warehouse;");
System.out.println(result);
result = m_pt.planSql("select * from WAREHOUSE, DISTRICT, CUSTOMER, CUSTOMER_NAME, HISTORY, STOCK, ORDERS, NEW_ORDER, ORDER_LINE where " +
"WAREHOUSE.W_ID = DISTRICT.D_W_ID and " +
"WAREHOUSE.W_ID = CUSTOMER.C_W_ID and " +
"WAREHOUSE.W_ID = CUSTOMER_NAME.C_W_ID and " +
"WAREHOUSE.W_ID = HISTORY.H_W_ID and " +
"WAREHOUSE.W_ID = STOCK.S_W_ID and " +
"WAREHOUSE.W_ID = ORDERS.O_W_ID and " +
"WAREHOUSE.W_ID = NEW_ORDER.NO_W_ID and " +
"WAREHOUSE.W_ID = ORDER_LINE.OL_W_ID and " +
"WAREHOUSE.W_ID = 0");
System.out.println(result);
result = m_pt.planSql("ryan likes the yankees");
System.out.println(result);
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
result = m_pt.planSql("ryan likes the yankees");
System.out.println(result);
result = m_pt.planSql("select * from warehouse;");
System.out.println(result);
final File jar = new File("tpcc-oop.jar");
jar.delete();
ptKiller.m_shouldStop.set(true);
try {
ptKiller.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}