use of org.apache.hyracks.storage.am.common.IIndexTestWorkerFactory in project asterixdb by apache.
the class AbstractRTreeMultiThreadTest method runTest.
protected void runTest(ISerializerDeserializer[] fieldSerdes, IPrimitiveValueProviderFactory[] valueProviderFactories, int numKeys, RTreePolicyType rtreePolicyType, int numThreads, TestWorkloadConf conf, String dataMsg) throws HyracksDataException, InterruptedException {
setUp();
if (LOGGER.isLoggable(Level.INFO)) {
String indexTypeName = getIndexTypeName();
LOGGER.info(indexTypeName + " MultiThread Test:\nData: " + dataMsg + "; Threads: " + numThreads + "; Workload: " + conf.toString() + ".");
}
ITypeTraits[] typeTraits = SerdeUtils.serdesToTypeTraits(fieldSerdes);
IBinaryComparatorFactory[] rtreeCmpFactories = SerdeUtils.serdesToComparatorFactories(fieldSerdes, numKeys);
int[] btreeFields = null;
IBinaryComparatorFactory[] btreeCmpFactories;
if (rTreeType == RTreeType.LSMRTREE) {
int numBtreeFields = fieldSerdes.length - numKeys;
ISerializerDeserializer[] btreeFieldSerdes = new ISerializerDeserializer[numBtreeFields];
btreeFields = new int[numBtreeFields];
for (int i = 0; i < numBtreeFields; i++) {
btreeFields[i] = numKeys + i;
btreeFieldSerdes[i] = fieldSerdes[numKeys + i];
}
btreeCmpFactories = SerdeUtils.serdesToComparatorFactories(btreeFieldSerdes, numBtreeFields);
} else {
btreeCmpFactories = SerdeUtils.serdesToComparatorFactories(fieldSerdes, fieldSerdes.length);
}
ITreeIndex index = createTreeIndex(typeTraits, rtreeCmpFactories, btreeCmpFactories, valueProviderFactories, rtreePolicyType, btreeFields);
IIndexTestWorkerFactory workerFactory = getWorkerFactory();
// 4 batches per thread.
int batchSize = (NUM_OPERATIONS / numThreads) / 4;
IndexMultiThreadTestDriver driver = new IndexMultiThreadTestDriver(index, workerFactory, fieldSerdes, conf.ops, conf.opProbs);
driver.init();
long[] times = driver.run(numThreads, 1, NUM_OPERATIONS, batchSize);
driver.deinit();
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("RTree MultiThread Test Time: " + times[0] + "ms");
}
tearDown();
}
use of org.apache.hyracks.storage.am.common.IIndexTestWorkerFactory in project asterixdb by apache.
the class OrderedIndexMultiThreadTest method runTest.
protected void runTest(ISerializerDeserializer[] fieldSerdes, int numKeys, int numThreads, TestWorkloadConf conf, String dataMsg) throws InterruptedException, HyracksDataException {
setUp();
if (LOGGER.isLoggable(Level.INFO)) {
String indexTypeName = getIndexTypeName();
LOGGER.info(indexTypeName + " MultiThread Test:\nData: " + dataMsg + "; Threads: " + numThreads + "; Workload: " + conf.toString() + ".");
}
ITypeTraits[] typeTraits = SerdeUtils.serdesToTypeTraits(fieldSerdes);
IBinaryComparatorFactory[] cmpFactories = SerdeUtils.serdesToComparatorFactories(fieldSerdes, numKeys);
// This is only used for the LSM-BTree.
int[] bloomFilterKeyFields = new int[numKeys];
for (int i = 0; i < numKeys; ++i) {
bloomFilterKeyFields[i] = i;
}
IIndex index = createIndex(typeTraits, cmpFactories, bloomFilterKeyFields);
IIndexTestWorkerFactory workerFactory = getWorkerFactory();
// 4 batches per thread.
int batchSize = (NUM_OPERATIONS / numThreads) / 4;
IndexMultiThreadTestDriver driver = new IndexMultiThreadTestDriver(index, workerFactory, fieldSerdes, conf.ops, conf.opProbs);
driver.init();
long[] times = driver.run(numThreads, 1, NUM_OPERATIONS, batchSize);
index.validate();
driver.deinit();
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("BTree MultiThread Test Time: " + times[0] + "ms");
}
tearDown();
}
Aggregations