Search in sources :

Example 1 with ExternalBTreeWithBuddyLocalResourceFactory

use of org.apache.hyracks.storage.am.lsm.btree.dataflow.ExternalBTreeWithBuddyLocalResourceFactory in project asterixdb by apache.

the class BTreeResourceFactoryProvider method getResourceFactory.

@Override
public IResourceFactory getResourceFactory(MetadataProvider mdProvider, Dataset dataset, Index index, ARecordType recordType, ARecordType metaType, ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, ITypeTraits[] filterTypeTraits, IBinaryComparatorFactory[] filterCmpFactories) throws AlgebricksException {
    int[] filterFields = IndexUtil.getFilterFields(dataset, index, filterTypeTraits);
    int[] btreeFields = IndexUtil.getBtreeFieldsIfFiltered(dataset, index);
    IStorageComponentProvider storageComponentProvider = mdProvider.getStorageComponentProvider();
    ITypeTraits[] typeTraits = getTypeTraits(mdProvider, dataset, index, recordType, metaType);
    IBinaryComparatorFactory[] cmpFactories = getCmpFactories(mdProvider, dataset, index, recordType, metaType);
    int[] bloomFilterFields = getBloomFilterFields(dataset, index);
    boolean durable = !dataset.isTemp();
    double bloomFilterFalsePositiveRate = mdProvider.getStorageProperties().getBloomFilterFalsePositiveRate();
    ILSMOperationTrackerFactory opTrackerFactory = dataset.getIndexOperationTrackerFactory(index);
    ILSMIOOperationCallbackFactory ioOpCallbackFactory = dataset.getIoOperationCallbackFactory(index);
    IStorageManager storageManager = storageComponentProvider.getStorageManager();
    IMetadataPageManagerFactory metadataPageManagerFactory = storageComponentProvider.getMetadataPageManagerFactory();
    ILSMIOOperationSchedulerProvider ioSchedulerProvider = storageComponentProvider.getIoOperationSchedulerProvider();
    switch(dataset.getDatasetType()) {
        case EXTERNAL:
            return index.getIndexName().equals(IndexingConstants.getFilesIndexName(dataset.getDatasetName())) ? new ExternalBTreeLocalResourceFactory(storageManager, typeTraits, cmpFactories, filterTypeTraits, filterCmpFactories, filterFields, opTrackerFactory, ioOpCallbackFactory, metadataPageManagerFactory, ioSchedulerProvider, mergePolicyFactory, mergePolicyProperties, durable, bloomFilterFields, bloomFilterFalsePositiveRate, false, btreeFields) : new ExternalBTreeWithBuddyLocalResourceFactory(storageManager, typeTraits, cmpFactories, filterTypeTraits, filterCmpFactories, filterFields, opTrackerFactory, ioOpCallbackFactory, metadataPageManagerFactory, ioSchedulerProvider, mergePolicyFactory, mergePolicyProperties, durable, bloomFilterFields, bloomFilterFalsePositiveRate, false, btreeFields);
        case INTERNAL:
            AsterixVirtualBufferCacheProvider vbcProvider = new AsterixVirtualBufferCacheProvider(dataset.getDatasetId());
            return new LSMBTreeLocalResourceFactory(storageManager, typeTraits, cmpFactories, filterTypeTraits, filterCmpFactories, filterFields, opTrackerFactory, ioOpCallbackFactory, metadataPageManagerFactory, vbcProvider, ioSchedulerProvider, mergePolicyFactory, mergePolicyProperties, durable, bloomFilterFields, bloomFilterFalsePositiveRate, index.isPrimaryIndex(), btreeFields);
        default:
            throw new CompilationException(ErrorCode.COMPILATION_UNKNOWN_DATASET_TYPE, dataset.getDatasetType().toString());
    }
}
Also used : CompilationException(org.apache.asterix.common.exceptions.CompilationException) ILSMIOOperationCallbackFactory(org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory) IStorageComponentProvider(org.apache.asterix.common.context.IStorageComponentProvider) ExternalBTreeLocalResourceFactory(org.apache.hyracks.storage.am.lsm.btree.dataflow.ExternalBTreeLocalResourceFactory) ITypeTraits(org.apache.hyracks.api.dataflow.value.ITypeTraits) IMetadataPageManagerFactory(org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory) IBinaryComparatorFactory(org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory) AsterixVirtualBufferCacheProvider(org.apache.asterix.common.context.AsterixVirtualBufferCacheProvider) ILSMOperationTrackerFactory(org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory) ExternalBTreeWithBuddyLocalResourceFactory(org.apache.hyracks.storage.am.lsm.btree.dataflow.ExternalBTreeWithBuddyLocalResourceFactory) IStorageManager(org.apache.hyracks.storage.common.IStorageManager) ILSMIOOperationSchedulerProvider(org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationSchedulerProvider) LSMBTreeLocalResourceFactory(org.apache.hyracks.storage.am.lsm.btree.dataflow.LSMBTreeLocalResourceFactory)

Aggregations

AsterixVirtualBufferCacheProvider (org.apache.asterix.common.context.AsterixVirtualBufferCacheProvider)1 IStorageComponentProvider (org.apache.asterix.common.context.IStorageComponentProvider)1 CompilationException (org.apache.asterix.common.exceptions.CompilationException)1 IBinaryComparatorFactory (org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory)1 ITypeTraits (org.apache.hyracks.api.dataflow.value.ITypeTraits)1 IMetadataPageManagerFactory (org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory)1 ExternalBTreeLocalResourceFactory (org.apache.hyracks.storage.am.lsm.btree.dataflow.ExternalBTreeLocalResourceFactory)1 ExternalBTreeWithBuddyLocalResourceFactory (org.apache.hyracks.storage.am.lsm.btree.dataflow.ExternalBTreeWithBuddyLocalResourceFactory)1 LSMBTreeLocalResourceFactory (org.apache.hyracks.storage.am.lsm.btree.dataflow.LSMBTreeLocalResourceFactory)1 ILSMIOOperationCallbackFactory (org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory)1 ILSMIOOperationSchedulerProvider (org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationSchedulerProvider)1 ILSMOperationTrackerFactory (org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory)1 IStorageManager (org.apache.hyracks.storage.common.IStorageManager)1