本文整理汇总了Java中org.voltdb.client.ClientResponse.getBasePartition方法的典型用法代码示例。如果您正苦于以下问题:Java ClientResponse.getBasePartition方法的具体用法?Java ClientResponse.getBasePartition怎么用?Java ClientResponse.getBasePartition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.client.ClientResponse
的用法示例。
在下文中一共展示了ClientResponse.getBasePartition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEarlyPrepare
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
/**
* testEarlyPrepare
*/
public void testEarlyPrepare() throws Exception {
CatalogContext catalogContext = this.getCatalogContext();
Client client = this.getClient();
RegressionSuiteUtil.initializeTPCCDatabase(catalogContext, client, true);
String procName = neworder.class.getSimpleName();
Object params[] = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, true, WAREHOUSE_ID, DISTRICT_ID);
ClientResponse cr = client.callProcedure(procName, params);
assertTrue(cr.hasDebug());
PartitionSet touched = new PartitionSet(cr.getDebug().getExecTouchedPartitions());
assertEquals(cr.toString(), 2, touched.size());
int basePartition = cr.getBasePartition();
assertTrue(cr.toString(), touched.contains(basePartition));
PartitionSet early = cr.getDebug().getEarlyPreparePartitions();
assertFalse(cr.toString(), early.isEmpty());
touched.remove(basePartition);
int remotePartition = touched.get();
assertNotSame(HStoreConstants.NULL_PARTITION_ID, remotePartition);
// System.err.println(cr);
assertFalse(cr.toString(), early.contains(basePartition));
assertTrue(cr.toString(), early.contains(remotePartition));
}
示例2: Entry
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
public Entry(ClientResponse cr, int clientId, int txnNameId, long timestamp) {
this.txnNameId = txnNameId;
this.clientId = clientId;
this.timestamp = timestamp;
this.singlePartition = cr.isSinglePartition();
this.basePartition = cr.getBasePartition();
this.status = cr.getStatus();
this.resultSize = cr.getResultsSize();
this.clusterRoundTrip = cr.getClusterRoundtrip();
this.clientRoundTrip = cr.getClientRoundtrip();
this.restartCounter = cr.getRestartCounter();
}
示例3: testRemoteQueryEstimates
import org.voltdb.client.ClientResponse; //导入方法依赖的package包/类
/**
* testRemoteQueryEstimates
*/
public void testRemoteQueryEstimates() throws Exception {
CatalogContext catalogContext = this.getCatalogContext();
Client client = this.getClient();
RegressionSuiteUtil.initializeTPCCDatabase(catalogContext, client, true);
// We have to turn off caching to ensure that we get a full path estimate each time
RegressionSuiteUtil.setHStoreConf(client, "site.markov_path_caching", false);
// Check to make sure that the system sends query estimates to remote sites for dtxns
// This may not work correctly for one site tests.
// We need to execute the same request multiple times to ensure that the MarkovGraph
// has all of the vertices that we need. We'll then invoke @MarkovUpdate and then
// request the txn one more time
String procName = neworder.class.getSimpleName();
Object params[] = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, true, WAREHOUSE_ID, DISTRICT_ID);
ClientResponse cr = null;
int repeat = 2;
for (int i = 0; i < repeat; i++) {
cr = client.callProcedure(procName, params);
assertFalse(cr.toString(), cr.isSinglePartition());
// System.err.println(cr);
if (i == 0) {
// Sleep for a little bit to make sure that the MarkovEstimatorState is cleaned up
ThreadUtil.sleep(1000);
cr = client.callProcedure(VoltSystemProcedure.procCallName(MarkovUpdate.class), false);
// System.err.println(cr);
assertEquals(cr.toString(), Status.OK, cr.getStatus());
}
} // FOR
assertTrue(cr.hasDebug());
ClientResponseDebug crDebug = cr.getDebug();
assertFalse(crDebug.toString(), crDebug.isPredictSinglePartition());
assertFalse(cr.toString(), cr.isSpeculative());
assertEquals(crDebug.toString(), crDebug.getPredictTouchedPartitions(), crDebug.getExecTouchedPartitions());
assertEquals(crDebug.toString(), crDebug.getPredictTouchedPartitions(), crDebug.getExecTouchedPartitions());
Procedure catalog_proc = catalogContext.procedures.getIgnoreCase(procName);
Set<Statement> expectedStmts = new HashSet<Statement>();
expectedStmts.add(catalog_proc.getStatements().getIgnoreCase("getStockInfo"));
expectedStmts.add(catalog_proc.getStatements().getIgnoreCase("updateStock"));
for (int partition : crDebug.getExecTouchedPartitions()) {
List<CountedStatement> query_estimates[] = crDebug.getRemoteQueryEstimates(catalogContext, partition);
assertNotNull(query_estimates);
// System.err.println("PARTITION: " + partition);
// for (List<CountedStatement> queries : query_estimates) {
// System.err.println(StringUtil.join("\n", queries));
// System.err.println("------");
// } // FOR
// System.err.println();
if (partition == cr.getBasePartition()) {
// We can ignore anything on the base partition
// XXX: Should we be getting remote query estimates at the base partition???
} else {
// We should only see updateStock and getStockInfo on the remote partition
// We'll only examine the last query estimate
Set<CountedStatement> seenQueries = new HashSet<CountedStatement>();
for (CountedStatement cs : CollectionUtil.last(query_estimates)) {
assertTrue(cs.toString(), expectedStmts.contains(cs.statement));
assertFalse(cs.toString(), seenQueries.contains(cs));
seenQueries.add(cs);
} // FOR
assertFalse(seenQueries.isEmpty());
}
} // FOR
}