Search in sources :

Example 6 with BloomFilter

use of org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter in project asterixdb by apache.

the class ExternalBTreeWithBuddy method activate.

@Override
public void activate() throws HyracksDataException {
    if (isActive) {
        throw new HyracksDataException("Failed to activate the index since it is already activated.");
    }
    if (diskComponents.size() == 0 && secondDiskComponents.size() == 0) {
        //First time activation
        List<LSMComponentFileReferences> validFileReferences;
        validFileReferences = fileManager.cleanupAndGetValidFiles();
        for (LSMComponentFileReferences lsmComonentFileReference : validFileReferences) {
            LSMBTreeWithBuddyDiskComponent component;
            component = createDiskComponent(componentFactory, lsmComonentFileReference.getInsertIndexFileReference(), lsmComonentFileReference.getDeleteIndexFileReference(), lsmComonentFileReference.getBloomFilterFileReference(), false);
            diskComponents.add(component);
            secondDiskComponents.add(component);
        }
        ((ExternalIndexHarness) getLsmHarness()).indexFirstTimeActivated();
    } else {
        // components. It should also maintain the version pointer
        for (ILSMComponent c : diskComponents) {
            LSMBTreeWithBuddyDiskComponent component = (LSMBTreeWithBuddyDiskComponent) c;
            BTree btree = component.getBTree();
            BTree buddyBtree = component.getBuddyBTree();
            BloomFilter bloomFilter = component.getBloomFilter();
            btree.activate();
            buddyBtree.activate();
            bloomFilter.activate();
        }
        for (ILSMComponent c : secondDiskComponents) {
            // Only activate non shared components
            if (!diskComponents.contains(c)) {
                LSMBTreeWithBuddyDiskComponent component = (LSMBTreeWithBuddyDiskComponent) c;
                BTree btree = component.getBTree();
                BTree buddyBtree = component.getBuddyBTree();
                BloomFilter bloomFilter = component.getBloomFilter();
                btree.activate();
                buddyBtree.activate();
                bloomFilter.activate();
            }
        }
    }
    isActive = true;
}
Also used : ILSMComponent(org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent) BTree(org.apache.hyracks.storage.am.btree.impls.BTree) ExternalIndexHarness(org.apache.hyracks.storage.am.lsm.common.impls.ExternalIndexHarness) LSMComponentFileReferences(org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) BloomFilter(org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter)

Example 7 with BloomFilter

use of org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter in project asterixdb by apache.

the class ExternalBTree method activate.

@Override
public synchronized void activate() throws HyracksDataException {
    if (isActive) {
        throw new HyracksDataException("Failed to activate the index since it is already activated.");
    }
    if (diskComponents.size() == 0 && secondDiskComponents.size() == 0) {
        //First time activation
        List<LSMComponentFileReferences> validFileReferences;
        validFileReferences = fileManager.cleanupAndGetValidFiles();
        for (LSMComponentFileReferences lsmComonentFileReference : validFileReferences) {
            LSMBTreeDiskComponent component;
            component = createDiskComponent(componentFactory, lsmComonentFileReference.getInsertIndexFileReference(), lsmComonentFileReference.getBloomFilterFileReference(), false);
            diskComponents.add(component);
            secondDiskComponents.add(component);
        }
        getLsmHarness().indexFirstTimeActivated();
    } else {
        // This index has been opened before
        for (ILSMComponent c : diskComponents) {
            LSMBTreeDiskComponent component = (LSMBTreeDiskComponent) c;
            BTree btree = component.getBTree();
            BloomFilter bloomFilter = component.getBloomFilter();
            btree.activate();
            bloomFilter.activate();
        }
        for (ILSMComponent c : secondDiskComponents) {
            // Only activate non shared components
            if (!diskComponents.contains(c)) {
                LSMBTreeDiskComponent component = (LSMBTreeDiskComponent) c;
                BTree btree = component.getBTree();
                BloomFilter bloomFilter = component.getBloomFilter();
                btree.activate();
                bloomFilter.activate();
            }
        }
    }
    isActive = true;
}
Also used : ILSMComponent(org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent) BTree(org.apache.hyracks.storage.am.btree.impls.BTree) LSMComponentFileReferences(org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) BloomFilter(org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter)

Example 8 with BloomFilter

use of org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter in project asterixdb by apache.

the class ExternalBTreeWithBuddy method deactivateDiskComponent.

@Override
protected void deactivateDiskComponent(ILSMDiskComponent c) throws HyracksDataException {
    LSMBTreeWithBuddyDiskComponent component = (LSMBTreeWithBuddyDiskComponent) c;
    BTree btree = component.getBTree();
    BTree buddyBtree = component.getBuddyBTree();
    BloomFilter bloomFilter = component.getBloomFilter();
    btree.deactivateCloseHandle();
    buddyBtree.deactivateCloseHandle();
    bloomFilter.deactivate();
}
Also used : BTree(org.apache.hyracks.storage.am.btree.impls.BTree) BloomFilter(org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter)

Example 9 with BloomFilter

use of org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter in project asterixdb by apache.

the class ExternalRTree method deactivate.

@Override
public void deactivate(boolean flushOnExit) throws HyracksDataException {
    if (!isActive) {
        throw new HyracksDataException("Failed to deactivate the index since it is already deactivated.");
    }
    if (flushOnExit) {
        BlockingIOOperationCallbackWrapper cb = new BlockingIOOperationCallbackWrapper(ioOpCallback);
        cb.afterFinalize(LSMOperationType.FLUSH, null);
    }
    for (ILSMComponent c : diskComponents) {
        LSMRTreeDiskComponent component = (LSMRTreeDiskComponent) c;
        RTree rtree = component.getRTree();
        BTree btree = component.getBTree();
        BloomFilter bloomFilter = component.getBloomFilter();
        rtree.deactivateCloseHandle();
        btree.deactivateCloseHandle();
        bloomFilter.deactivate();
    }
    for (ILSMComponent c : secondDiskComponents) {
        // Only deactivate non shared components
        if (!diskComponents.contains(c)) {
            LSMRTreeDiskComponent component = (LSMRTreeDiskComponent) c;
            RTree rtree = component.getRTree();
            BTree btree = component.getBTree();
            BloomFilter bloomFilter = component.getBloomFilter();
            rtree.deactivateCloseHandle();
            btree.deactivateCloseHandle();
            bloomFilter.deactivate();
        }
    }
    isActive = false;
}
Also used : ILSMComponent(org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent) BTree(org.apache.hyracks.storage.am.btree.impls.BTree) BlockingIOOperationCallbackWrapper(org.apache.hyracks.storage.am.lsm.common.impls.BlockingIOOperationCallbackWrapper) RTree(org.apache.hyracks.storage.am.rtree.impls.RTree) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) BloomFilter(org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter)

Aggregations

BloomFilter (org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilter)9 BTree (org.apache.hyracks.storage.am.btree.impls.BTree)7 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)5 ILSMComponent (org.apache.hyracks.storage.am.lsm.common.api.ILSMComponent)5 LSMComponentFileReferences (org.apache.hyracks.storage.am.lsm.common.impls.LSMComponentFileReferences)3 RTree (org.apache.hyracks.storage.am.rtree.impls.RTree)3 ArrayList (java.util.ArrayList)2 ArrayTupleBuilder (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)2 ArrayTupleReference (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference)2 BloomFilterSpecification (org.apache.hyracks.storage.am.bloomfilter.impls.BloomFilterSpecification)2 AbstractBloomFilterTest (org.apache.hyracks.storage.am.bloomfilter.util.AbstractBloomFilterTest)2 BlockingIOOperationCallbackWrapper (org.apache.hyracks.storage.am.lsm.common.impls.BlockingIOOperationCallbackWrapper)2 IIndexBulkLoader (org.apache.hyracks.storage.common.IIndexBulkLoader)2 IBufferCache (org.apache.hyracks.storage.common.buffercache.IBufferCache)2 Test (org.junit.Test)2 TreeSet (java.util.TreeSet)1 ISerializerDeserializer (org.apache.hyracks.api.dataflow.value.ISerializerDeserializer)1 UTF8StringSerializerDeserializer (org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer)1 ExternalIndexHarness (org.apache.hyracks.storage.am.lsm.common.impls.ExternalIndexHarness)1