use of org.voltdb.expressions.HashRangeExpressionBuilder in project voltdb by VoltDB.
the class TestExecutionEngine method testStreamIndex.
public void testStreamIndex() throws Exception {
sourceEngine.loadCatalog(0, m_catalog.serialize());
// Each EE needs its own thread for correct initialization.
final AtomicReference<ExecutionEngine> destinationEngine = new AtomicReference<ExecutionEngine>();
final byte[] configBytes = LegacyHashinator.getConfigureBytes(1);
Thread destEEThread = new Thread() {
@Override
public void run() {
destinationEngine.set(new ExecutionEngineJNI(CLUSTER_ID, NODE_ID, 0, 0, "", 0, 64 * 1024, 100, new HashinatorConfig(HashinatorType.LEGACY, configBytes, 0, 0), false));
}
};
destEEThread.start();
destEEThread.join();
destinationEngine.get().loadCatalog(0, m_catalog.serialize());
int STOCK_TABLEID = stockTableId(m_catalog);
loadTestTables(sourceEngine, m_catalog);
SnapshotPredicates predicates = new SnapshotPredicates(-1);
predicates.addPredicate(new HashRangeExpressionBuilder().put(0x00000000, 0x7fffffff).build(0), true);
// Build the index
sourceEngine.activateTableStream(STOCK_TABLEID, TableStreamType.ELASTIC_INDEX, Long.MAX_VALUE, predicates.toBytes());
// Humor serializeMore() by providing a buffer, even though it's not used.
final BBContainer origin = DBBPool.allocateDirect(1024 * 1024 * 2);
origin.b().clear();
BBContainer container = new BBContainer(origin.b()) {
@Override
public void discard() {
checkDoubleFree();
origin.discard();
}
};
try {
List<BBContainer> output = new ArrayList<BBContainer>();
output.add(container);
assertEquals(0, sourceEngine.tableStreamSerializeMore(STOCK_TABLEID, TableStreamType.ELASTIC_INDEX, output).getSecond()[0]);
} finally {
container.discard();
}
}
Aggregations