use of org.apache.hyracks.storage.common.IIndex 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();
}
use of org.apache.hyracks.storage.common.IIndex in project asterixdb by apache.
the class ExternalDatasetIndexesCommitOperatorDescriptor method performOpOnIndex.
@Override
protected void performOpOnIndex(IIndexDataflowHelper indexHelper, IHyracksTaskContext ctx) throws HyracksDataException {
String path = indexHelper.getResource().getPath();
IIOManager ioManager = ctx.getIoManager();
FileReference file = ioManager.resolve(path);
LOGGER.warn("performing the operation on " + file.getFile().getAbsolutePath());
// Get index
IIndex index = indexHelper.getIndexInstance();
// commit transaction
((ITwoPCIndex) index).commitTransaction();
LOGGER.warn("operation on " + file.getFile().getAbsolutePath() + " Succeded");
}
use of org.apache.hyracks.storage.common.IIndex in project asterixdb by apache.
the class AbstractInvertedIndexTest method validateAndCheckIndex.
/**
* Validates the index, and compares it against the expected index.
* This test is only for verifying the integrity and correctness of the index,
* it does not ensure the correctness of index searches.
*/
protected void validateAndCheckIndex(LSMInvertedIndexTestContext testCtx) throws HyracksDataException {
IIndex invIndex = testCtx.getIndex();
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Validating index: " + invIndex);
}
// Validate index and compare against expected index.
invIndex.validate();
if (invIndexType == InvertedIndexType.INMEMORY || invIndexType == InvertedIndexType.ONDISK) {
// This comparison method exercises different features of these types of inverted indexes.
LSMInvertedIndexTestUtils.compareActualAndExpectedIndexes(testCtx);
}
LSMInvertedIndexTestUtils.compareActualAndExpectedIndexesRangeSearch(testCtx);
}
use of org.apache.hyracks.storage.common.IIndex in project asterixdb by apache.
the class LSMInvertedIndexMergeTest method runTest.
@Override
protected void runTest(LSMInvertedIndexTestContext testCtx, TupleGenerator tupleGen) throws IOException {
IIndex invIndex = testCtx.getIndex();
invIndex.create();
invIndex.activate();
ILSMIndexAccessor invIndexAccessor = (ILSMIndexAccessor) invIndex.createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
for (int i = 0; i < maxTreesToMerge; i++) {
for (int j = 0; j < i; j++) {
LSMInvertedIndexTestUtils.insertIntoInvIndex(testCtx, tupleGen, NUM_DOCS_TO_INSERT);
// Deactivate and the re-activate the index to force it flush its in memory component
invIndex.deactivate();
invIndex.activate();
}
// Perform merge.
invIndexAccessor.scheduleMerge(NoOpIOOperationCallbackFactory.INSTANCE.createIoOpCallback(), ((LSMInvertedIndex) invIndex).getImmutableComponents());
validateAndCheckIndex(testCtx);
runTinySearchWorkload(testCtx, tupleGen);
}
invIndex.deactivate();
invIndex.destroy();
}
use of org.apache.hyracks.storage.common.IIndex in project asterixdb by apache.
the class PartitionedLSMInvertedIndexMergeTest method runTest.
@Override
protected void runTest(LSMInvertedIndexTestContext testCtx, TupleGenerator tupleGen) throws IOException, HyracksDataException {
IIndex invIndex = testCtx.getIndex();
invIndex.create();
invIndex.activate();
ILSMIndexAccessor invIndexAccessor = (ILSMIndexAccessor) invIndex.createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
for (int i = 0; i < maxTreesToMerge; i++) {
for (int j = 0; j < i; j++) {
LSMInvertedIndexTestUtils.insertIntoInvIndex(testCtx, tupleGen, NUM_DOCS_TO_INSERT);
// Deactivate and the re-activate the index to force it flush its in memory component
invIndex.deactivate();
invIndex.activate();
}
// Perform merge.
invIndexAccessor.scheduleMerge(NoOpIOOperationCallbackFactory.INSTANCE.createIoOpCallback(), ((LSMInvertedIndex) invIndex).getImmutableComponents());
validateAndCheckIndex(testCtx);
runTinySearchWorkload(testCtx, tupleGen);
}
invIndex.deactivate();
invIndex.destroy();
}
Aggregations