http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java index 5a395f7..8c5b099 100644 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexModificationOperationCallbackFactory.java @@ -20,6 +20,7 @@ package org.apache.asterix.transaction.management.opcallbacks; import org.apache.asterix.common.context.ITransactionSubsystemProvider; +import org.apache.asterix.common.dataflow.DatasetLocalResource; import org.apache.asterix.common.exceptions.ACIDException; import org.apache.asterix.common.transactions.AbstractOperationCallback; import org.apache.asterix.common.transactions.AbstractOperationCallbackFactory; @@ -27,16 +28,15 @@ import org.apache.asterix.common.transactions.DatasetId; import org.apache.asterix.common.transactions.ITransactionContext; import org.apache.asterix.common.transactions.ITransactionSubsystem; import org.apache.asterix.common.transactions.JobId; -import org.apache.asterix.common.transactions.Resource; import org.apache.asterix.transaction.management.opcallbacks.AbstractIndexModificationOperationCallback.Operation; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.dataflow.IOperatorNodePushable; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback; import org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory; -import org.apache.hyracks.storage.am.common.api.IResourceLifecycleManager; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.common.file.LocalResource; +import org.apache.hyracks.storage.common.IModificationOperationCallback; +import org.apache.hyracks.storage.common.IResourceLifecycleManager; +import org.apache.hyracks.storage.common.LocalResource; public class SecondaryIndexModificationOperationCallbackFactory extends AbstractOperationCallbackFactory implements IModificationOperationCallbackFactory { @@ -63,10 +63,10 @@ public class SecondaryIndexModificationOperationCallbackFactory extends Abstract try { ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId, false); - Resource aResource = (Resource) resource.getResource(); + DatasetLocalResource aResource = (DatasetLocalResource) resource.getResource(); IModificationOperationCallback modCallback = new SecondaryIndexModificationOperationCallback( new DatasetId(datasetId), primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem, - resource.getId(), aResource.partition(), resourceType, indexOp); + resource.getId(), aResource.getPartition(), resourceType, indexOp); txnCtx.registerIndexAndCallback(resource.getId(), index, (AbstractOperationCallback) modCallback, false); return modCallback; } catch (ACIDException e) {
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java index 6905033..108a77e 100644 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallback.java @@ -23,7 +23,7 @@ import org.apache.asterix.common.transactions.AbstractOperationCallback; import org.apache.asterix.common.transactions.DatasetId; import org.apache.hyracks.api.exceptions.HyracksDataException; import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference; -import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback; +import org.apache.hyracks.storage.common.ISearchOperationCallback; /** * Secondary index searches perform no locking at all. http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallbackFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallbackFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallbackFactory.java index 5dfdcdc..0b96164 100644 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallbackFactory.java +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/SecondaryIndexSearchOperationCallbackFactory.java @@ -22,8 +22,8 @@ package org.apache.asterix.transaction.management.opcallbacks; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.dataflow.IOperatorNodePushable; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.common.api.ISearchOperationCallback; import org.apache.hyracks.storage.am.common.api.ISearchOperationCallbackFactory; +import org.apache.hyracks.storage.common.ISearchOperationCallback; public class SecondaryIndexSearchOperationCallbackFactory implements ISearchOperationCallbackFactory { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetPrimaryIndexModificationOperationCallbackFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetPrimaryIndexModificationOperationCallbackFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetPrimaryIndexModificationOperationCallbackFactory.java index 1956c8d..7b7eff6 100644 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetPrimaryIndexModificationOperationCallbackFactory.java +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetPrimaryIndexModificationOperationCallbackFactory.java @@ -20,6 +20,7 @@ package org.apache.asterix.transaction.management.opcallbacks; import org.apache.asterix.common.context.ITransactionSubsystemProvider; +import org.apache.asterix.common.dataflow.DatasetLocalResource; import org.apache.asterix.common.exceptions.ACIDException; import org.apache.asterix.common.transactions.AbstractOperationCallback; import org.apache.asterix.common.transactions.AbstractOperationCallbackFactory; @@ -27,16 +28,15 @@ import org.apache.asterix.common.transactions.DatasetId; import org.apache.asterix.common.transactions.ITransactionContext; import org.apache.asterix.common.transactions.ITransactionSubsystem; import org.apache.asterix.common.transactions.JobId; -import org.apache.asterix.common.transactions.Resource; import org.apache.asterix.transaction.management.opcallbacks.AbstractIndexModificationOperationCallback.Operation; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.dataflow.IOperatorNodePushable; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback; import org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory; -import org.apache.hyracks.storage.am.common.api.IResourceLifecycleManager; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.common.file.LocalResource; +import org.apache.hyracks.storage.common.IModificationOperationCallback; +import org.apache.hyracks.storage.common.IResourceLifecycleManager; +import org.apache.hyracks.storage.common.LocalResource; public class TempDatasetPrimaryIndexModificationOperationCallbackFactory extends AbstractOperationCallbackFactory implements IModificationOperationCallbackFactory { @@ -64,10 +64,10 @@ public class TempDatasetPrimaryIndexModificationOperationCallbackFactory extends try { ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId, false); - Resource aResource = (Resource) resource.getResource(); + DatasetLocalResource aResource = (DatasetLocalResource) resource.getResource(); IModificationOperationCallback modCallback = new TempDatasetIndexModificationOperationCallback( new DatasetId(datasetId), primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem, - resource.getId(), aResource.partition(), resourceType, indexOp); + resource.getId(), aResource.getPartition(), resourceType, indexOp); txnCtx.registerIndexAndCallback(resource.getId(), index, (AbstractOperationCallback) modCallback, true); return modCallback; } catch (ACIDException e) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetSecondaryIndexModificationOperationCallbackFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetSecondaryIndexModificationOperationCallbackFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetSecondaryIndexModificationOperationCallbackFactory.java index 6e955af..1dc1c4e 100644 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetSecondaryIndexModificationOperationCallbackFactory.java +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/TempDatasetSecondaryIndexModificationOperationCallbackFactory.java @@ -20,6 +20,7 @@ package org.apache.asterix.transaction.management.opcallbacks; import org.apache.asterix.common.context.ITransactionSubsystemProvider; +import org.apache.asterix.common.dataflow.DatasetLocalResource; import org.apache.asterix.common.exceptions.ACIDException; import org.apache.asterix.common.transactions.AbstractOperationCallback; import org.apache.asterix.common.transactions.AbstractOperationCallbackFactory; @@ -27,16 +28,16 @@ import org.apache.asterix.common.transactions.DatasetId; import org.apache.asterix.common.transactions.ITransactionContext; import org.apache.asterix.common.transactions.ITransactionSubsystem; import org.apache.asterix.common.transactions.JobId; -import org.apache.asterix.common.transactions.Resource; import org.apache.asterix.transaction.management.opcallbacks.AbstractIndexModificationOperationCallback.Operation; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.dataflow.IOperatorNodePushable; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback; import org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory; -import org.apache.hyracks.storage.am.common.api.IResourceLifecycleManager; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.common.file.LocalResource; +import org.apache.hyracks.storage.common.IIndex; +import org.apache.hyracks.storage.common.IModificationOperationCallback; +import org.apache.hyracks.storage.common.IResourceLifecycleManager; +import org.apache.hyracks.storage.common.LocalResource; public class TempDatasetSecondaryIndexModificationOperationCallbackFactory extends AbstractOperationCallbackFactory implements IModificationOperationCallbackFactory { @@ -54,9 +55,9 @@ public class TempDatasetSecondaryIndexModificationOperationCallbackFactory exten @Override public IModificationOperationCallback createModificationOperationCallback(LocalResource resource, IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException { - Resource aResource = (Resource) resource.getResource(); + DatasetLocalResource aResource = (DatasetLocalResource) resource.getResource(); ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx); - IResourceLifecycleManager indexLifeCycleManager = + IResourceLifecycleManager<IIndex> indexLifeCycleManager = txnSubsystem.getAsterixAppRuntimeContextProvider().getDatasetLifecycleManager(); ILSMIndex index = (ILSMIndex) indexLifeCycleManager.get(resource.getPath()); if (index == null) { @@ -67,7 +68,7 @@ public class TempDatasetSecondaryIndexModificationOperationCallbackFactory exten ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId, false); IModificationOperationCallback modCallback = new TempDatasetIndexModificationOperationCallback( new DatasetId(datasetId), primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem, - resource.getId(), aResource.partition(), resourceType, indexOp); + resource.getId(), aResource.getPartition(), resourceType, indexOp); txnCtx.registerIndexAndCallback(resource.getId(), index, (AbstractOperationCallback) modCallback, false); return modCallback; } catch (ACIDException e) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/UpsertOperationCallbackFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/UpsertOperationCallbackFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/UpsertOperationCallbackFactory.java index 433bbf0..15b4344 100644 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/UpsertOperationCallbackFactory.java +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/opcallbacks/UpsertOperationCallbackFactory.java @@ -19,6 +19,7 @@ package org.apache.asterix.transaction.management.opcallbacks; import org.apache.asterix.common.context.ITransactionSubsystemProvider; +import org.apache.asterix.common.dataflow.DatasetLocalResource; import org.apache.asterix.common.exceptions.ACIDException; import org.apache.asterix.common.transactions.AbstractOperationCallback; import org.apache.asterix.common.transactions.AbstractOperationCallbackFactory; @@ -26,16 +27,15 @@ import org.apache.asterix.common.transactions.DatasetId; import org.apache.asterix.common.transactions.ITransactionContext; import org.apache.asterix.common.transactions.ITransactionSubsystem; import org.apache.asterix.common.transactions.JobId; -import org.apache.asterix.common.transactions.Resource; import org.apache.asterix.transaction.management.opcallbacks.AbstractIndexModificationOperationCallback.Operation; import org.apache.hyracks.api.context.IHyracksTaskContext; import org.apache.hyracks.api.dataflow.IOperatorNodePushable; import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.storage.am.common.api.IModificationOperationCallback; import org.apache.hyracks.storage.am.common.api.IModificationOperationCallbackFactory; -import org.apache.hyracks.storage.am.common.api.IResourceLifecycleManager; import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.common.file.LocalResource; +import org.apache.hyracks.storage.common.IModificationOperationCallback; +import org.apache.hyracks.storage.common.IResourceLifecycleManager; +import org.apache.hyracks.storage.common.LocalResource; public class UpsertOperationCallbackFactory extends AbstractOperationCallbackFactory implements IModificationOperationCallbackFactory { @@ -52,7 +52,7 @@ public class UpsertOperationCallbackFactory extends AbstractOperationCallbackFac @Override public IModificationOperationCallback createModificationOperationCallback(LocalResource resource, IHyracksTaskContext ctx, IOperatorNodePushable operatorNodePushable) throws HyracksDataException { - Resource aResource = (Resource) resource.getResource(); + DatasetLocalResource aResource = (DatasetLocalResource) resource.getResource(); ITransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx); IResourceLifecycleManager indexLifeCycleManager = txnSubsystem.getAsterixAppRuntimeContextProvider().getDatasetLifecycleManager(); @@ -65,7 +65,7 @@ public class UpsertOperationCallbackFactory extends AbstractOperationCallbackFac ITransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId, false); IModificationOperationCallback modCallback = new UpsertOperationCallback(new DatasetId(datasetId), primaryKeyFields, txnCtx, txnSubsystem.getLockManager(), txnSubsystem, resource.getId(), - aResource.partition(), resourceType, indexOp); + aResource.getPartition(), resourceType, indexOp); txnCtx.registerIndexAndCallback(resource.getId(), index, (AbstractOperationCallback) modCallback, true); return modCallback; } catch (ACIDException e) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/DatasetLocalResourceFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/DatasetLocalResourceFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/DatasetLocalResourceFactory.java new file mode 100644 index 0000000..8724128 --- /dev/null +++ b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/DatasetLocalResourceFactory.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.asterix.transaction.management.resource; + +import org.apache.asterix.common.dataflow.DatasetLocalResource; +import org.apache.asterix.common.utils.StoragePathUtil; +import org.apache.hyracks.api.io.FileReference; +import org.apache.hyracks.storage.common.IResource; +import org.apache.hyracks.storage.common.IResourceFactory; + +public class DatasetLocalResourceFactory implements IResourceFactory { + + private static final long serialVersionUID = 1L; + private final int datasetId; + private final IResourceFactory resourceFactory; + + public DatasetLocalResourceFactory(int datasetId, IResourceFactory resourceFactory) { + this.datasetId = datasetId; + this.resourceFactory = resourceFactory; + } + + @Override + public IResource createResource(FileReference fileRef) { + IResource resource = resourceFactory.createResource(fileRef); + // Currently, we get the partition number from the relative path + int partition = StoragePathUtil.getPartitionNumFromRelativePath(fileRef.getRelativePath()); + return new DatasetLocalResource(datasetId, partition, resource); + } +} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadata.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadata.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadata.java deleted file mode 100644 index 0fca60d..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadata.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.api.INcApplicationContext; -import org.apache.hyracks.api.application.INCServiceContext; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.FileReference; -import org.apache.hyracks.api.io.IIOManager; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.btree.utils.LSMBTreeUtil; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.common.file.LocalResource; - -public class ExternalBTreeLocalResourceMetadata extends LSMBTreeLocalResourceMetadata { - - private static final long serialVersionUID = 1L; - - public ExternalBTreeLocalResourceMetadata(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] cmpFactories, - int[] bloomFilterKeyFields, boolean isPrimary, int datasetID, int partition, - ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, - ILSMOperationTrackerFactory opTrackerProvider, ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(typeTraits, cmpFactories, bloomFilterKeyFields, isPrimary, datasetID, partition, mergePolicyFactory, - mergePolicyProperties, null, null, null, null, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - } - - @Override - public ILSMIndex createIndexInstance(INCServiceContext serviceCtx, LocalResource resource) - throws HyracksDataException { - INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext(); - IIOManager ioManager = appCtx.getIOManager(); - FileReference file = ioManager.resolve(resource.getPath()); - return LSMBTreeUtil.createExternalBTree(ioManager, file, appCtx.getBufferCache(), - appCtx.getFileMapManager(), typeTraits, cmpFactories, bloomFilterKeyFields, - appCtx.getBloomFilterFalsePositiveRate(), - mergePolicyFactory.createMergePolicy(mergePolicyProperties, - appCtx.getDatasetLifecycleManager()), - opTrackerProvider.getOperationTracker(serviceCtx), appCtx.getLSMIOScheduler(), - ioOpCallbackFactory.createIoOpCallback(), -1, true, metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadataFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadataFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadataFactory.java deleted file mode 100644 index ea25aab..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeLocalResourceMetadataFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.transactions.Resource; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; - -public class ExternalBTreeLocalResourceMetadataFactory extends LSMBTreeLocalResourceMetadataFactory { - - private static final long serialVersionUID = 1L; - - public ExternalBTreeLocalResourceMetadataFactory(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] cmpFactories, - int[] bloomFilterKeyFields, boolean isPrimary, int datasetID, - ILSMMergePolicyFactory mergePolicyFactory, - Map<String, String> mergePolicyProperties, ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(typeTraits, cmpFactories, bloomFilterKeyFields, isPrimary, datasetID, mergePolicyFactory, - mergePolicyProperties, null, null, null, null, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - } - - @Override - public Resource resource(int partition) { - return new ExternalBTreeLocalResourceMetadata(filterTypeTraits, filterCmpFactories, bloomFilterKeyFields, - isPrimary, datasetId, partition, mergePolicyFactory, mergePolicyProperties, opTrackerProvider, - ioOpCallbackFactory, metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadata.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadata.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadata.java deleted file mode 100644 index aa82113..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadata.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.api.INcApplicationContext; -import org.apache.asterix.common.transactions.Resource; -import org.apache.hyracks.api.application.INCServiceContext; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.FileReference; -import org.apache.hyracks.api.io.IIOManager; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.btree.utils.LSMBTreeUtil; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.common.file.LocalResource; - -/** - * The local resource for disk only lsm btree with buddy tree - */ -public class ExternalBTreeWithBuddyLocalResourceMetadata extends Resource { - - private static final long serialVersionUID = 1L; - - private final ITypeTraits[] typeTraits; - private final IBinaryComparatorFactory[] btreeCmpFactories; - private final ILSMMergePolicyFactory mergePolicyFactory; - private final Map<String, String> mergePolicyProperties; - private final int[] buddyBtreeFields; - - public ExternalBTreeWithBuddyLocalResourceMetadata(int datasetID, int partition, - IBinaryComparatorFactory[] btreeCmpFactories, ITypeTraits[] typeTraits, - ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, - int[] buddyBtreeFields, ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, partition, null, null, null, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - this.btreeCmpFactories = btreeCmpFactories; - this.typeTraits = typeTraits; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.buddyBtreeFields = buddyBtreeFields; - } - - @Override - public ILSMIndex createIndexInstance(INCServiceContext serviceCtx, LocalResource resource) - throws HyracksDataException { - INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext(); - IIOManager ioManager = serviceCtx.getIoManager(); - FileReference file = ioManager.resolve(resource.getPath()); - return LSMBTreeUtil.createExternalBTreeWithBuddy(ioManager, file, appCtx.getBufferCache(), - appCtx.getFileMapManager(), typeTraits, btreeCmpFactories, - appCtx.getBloomFilterFalsePositiveRate(), - mergePolicyFactory.createMergePolicy(mergePolicyProperties, - appCtx.getDatasetLifecycleManager()), - opTrackerProvider.getOperationTracker(serviceCtx), appCtx.getLSMIOScheduler(), - ioOpCallbackFactory.createIoOpCallback(), buddyBtreeFields, -1, true, metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadataFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadataFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadataFactory.java deleted file mode 100644 index 98cd6dc..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalBTreeWithBuddyLocalResourceMetadataFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.transactions.Resource; -import org.apache.asterix.common.transactions.ResourceFactory; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; - -public class ExternalBTreeWithBuddyLocalResourceMetadataFactory extends ResourceFactory { - private static final long serialVersionUID = 1L; - private final ITypeTraits[] typeTraits; - private final IBinaryComparatorFactory[] btreeCmpFactories; - private final ILSMMergePolicyFactory mergePolicyFactory; - private final Map<String, String> mergePolicyProperties; - private final int[] buddyBtreeFields; - - public ExternalBTreeWithBuddyLocalResourceMetadataFactory(int datasetID, - IBinaryComparatorFactory[] btreeCmpFactories, - ITypeTraits[] typeTraits, ILSMMergePolicyFactory mergePolicyFactory, - Map<String, String> mergePolicyProperties, int[] buddyBtreeFields, - ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, null, null, null, opTrackerProvider, ioOpCallbackFactory, metadataPageManagerFactory); - this.btreeCmpFactories = btreeCmpFactories; - this.typeTraits = typeTraits; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.buddyBtreeFields = buddyBtreeFields; - } - - @Override - public Resource resource(int partition) { - return new ExternalBTreeWithBuddyLocalResourceMetadata(datasetId, partition, btreeCmpFactories, typeTraits, - mergePolicyFactory, mergePolicyProperties, buddyBtreeFields, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadata.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadata.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadata.java deleted file mode 100644 index 75516ff..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadata.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.api.INcApplicationContext; -import org.apache.hyracks.api.application.INCServiceContext; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ILinearizeComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.FileReference; -import org.apache.hyracks.api.io.IIOManager; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.am.lsm.rtree.utils.LSMRTreeUtils; -import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; -import org.apache.hyracks.storage.common.file.LocalResource; - -/** - * The local resource class for disk only lsm r-tree - */ -public class ExternalRTreeLocalResourceMetadata extends LSMRTreeLocalResourceMetadata { - - private static final long serialVersionUID = 1L; - - public ExternalRTreeLocalResourceMetadata(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] rtreeCmpFactories, - IBinaryComparatorFactory[] btreeCmpFactories, IPrimitiveValueProviderFactory[] valueProviderFactories, - RTreePolicyType rtreePolicyType, ILinearizeComparatorFactory linearizeCmpFactory, int datasetID, - int partition, ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, - int[] btreeFields, boolean isPointMBR, ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(typeTraits, rtreeCmpFactories, btreeCmpFactories, valueProviderFactories, rtreePolicyType, - linearizeCmpFactory, datasetID, partition, mergePolicyFactory, mergePolicyProperties, null, null, null, - btreeFields, null, isPointMBR, opTrackerProvider, ioOpCallbackFactory, metadataPageManagerFactory); - } - - @Override - public ILSMIndex createIndexInstance(INCServiceContext serviceCtx, LocalResource resource) - throws HyracksDataException { - INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext(); - IIOManager ioManager = appCtx.getIOManager(); - FileReference file = ioManager.resolve(resource.getPath()); - return LSMRTreeUtils.createExternalRTree(ioManager, file, appCtx.getBufferCache(), appCtx.getFileMapManager(), - typeTraits, rtreeCmpFactories, btreeCmpFactories, valueProviderFactories, rtreePolicyType, - appCtx.getBloomFilterFalsePositiveRate(), - mergePolicyFactory.createMergePolicy(mergePolicyProperties, appCtx.getDatasetLifecycleManager()), - opTrackerProvider.getOperationTracker(serviceCtx), appCtx.getLSMIOScheduler(), - ioOpCallbackFactory.createIoOpCallback(), linearizeCmpFactory, btreeFields, -1, true, isPointMBR, - metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadataFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadataFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadataFactory.java deleted file mode 100644 index e46729a..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/ExternalRTreeLocalResourceMetadataFactory.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.transactions.Resource; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ILinearizeComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; - -public class ExternalRTreeLocalResourceMetadataFactory extends LSMRTreeLocalResourceMetadataFactory { - - private static final long serialVersionUID = 1L; - - public ExternalRTreeLocalResourceMetadataFactory(ITypeTraits[] typeTraits, - IBinaryComparatorFactory[] rtreeCmpFactories, - IBinaryComparatorFactory[] btreeCmpFactories, IPrimitiveValueProviderFactory[] valueProviderFactories, - RTreePolicyType rtreePolicyType, ILinearizeComparatorFactory linearizeCmpFactory, int datasetID, - ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, - int[] btreeFields, boolean isPointMBR, ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(typeTraits, rtreeCmpFactories, btreeCmpFactories, valueProviderFactories, rtreePolicyType, - linearizeCmpFactory, datasetID, mergePolicyFactory, mergePolicyProperties, null, null, null, - btreeFields, null, isPointMBR, opTrackerProvider, ioOpCallbackFactory, metadataPageManagerFactory); - } - - @Override - public Resource resource(int partition) { - return new ExternalRTreeLocalResourceMetadata(filterTypeTraits, rtreeCmpFactories, btreeCmpFactories, - valueProviderFactories, rtreePolicyType, linearizeCmpFactory, datasetId, partition, mergePolicyFactory, - mergePolicyProperties, btreeFields, isPointMBR, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - } - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java deleted file mode 100644 index 4bb30a8..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadata.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.api.INcApplicationContext; -import org.apache.asterix.common.api.IDatasetLifecycleManager; -import org.apache.asterix.common.transactions.Resource; -import org.apache.hyracks.api.application.INCServiceContext; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.FileReference; -import org.apache.hyracks.api.io.IIOManager; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.btree.utils.LSMBTreeUtil; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.common.file.LocalResource; - -public class LSMBTreeLocalResourceMetadata extends Resource { - - private static final long serialVersionUID = 1L; - - protected final ITypeTraits[] typeTraits; - protected final IBinaryComparatorFactory[] cmpFactories; - protected final int[] bloomFilterKeyFields; - protected final boolean isPrimary; - protected final ILSMMergePolicyFactory mergePolicyFactory; - protected final Map<String, String> mergePolicyProperties; - protected final int[] btreeFields; - - public LSMBTreeLocalResourceMetadata(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] cmpFactories, - int[] bloomFilterKeyFields, boolean isPrimary, int datasetID, int partition, - ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, - ITypeTraits[] filterTypeTraits, IBinaryComparatorFactory[] filterCmpFactories, int[] btreeFields, - int[] filterFields, ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, partition, filterTypeTraits, filterCmpFactories, filterFields, opTrackerProvider, - ioOpCallbackFactory, metadataPageManagerFactory); - this.typeTraits = typeTraits; - this.cmpFactories = cmpFactories; - this.bloomFilterKeyFields = bloomFilterKeyFields; - this.isPrimary = isPrimary; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.btreeFields = btreeFields; - } - - @Override - public String toString() { - return new StringBuilder().append(" { \"").append(LSMBTreeLocalResourceMetadata.class.getName()) - .append("\" : {").append("\"datasetId\" : ").append(datasetId()).append(", \"partition\" : ") - .append(partition()).append(" } ").append(" }").toString(); - } - - @Override - public ILSMIndex createIndexInstance(INCServiceContext serviceCtx, LocalResource resource) - throws HyracksDataException { - INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext(); - IIOManager ioManager = appCtx.getIOManager(); - FileReference file = ioManager.resolve(resource.getPath()); - int ioDeviceNum = Resource.getIoDeviceNum(ioManager, file.getDeviceHandle()); - final IDatasetLifecycleManager datasetLifecycleManager = appCtx.getDatasetLifecycleManager(); - return LSMBTreeUtil.createLSMTree(ioManager, - datasetLifecycleManager.getVirtualBufferCaches(datasetId(), ioDeviceNum), file, - appCtx.getBufferCache(), appCtx.getFileMapManager(), typeTraits, cmpFactories, - bloomFilterKeyFields, appCtx.getBloomFilterFalsePositiveRate(), - mergePolicyFactory.createMergePolicy(mergePolicyProperties, datasetLifecycleManager), - opTrackerProvider.getOperationTracker(serviceCtx), appCtx.getLSMIOScheduler(), - ioOpCallbackFactory.createIoOpCallback(), isPrimary, filterTypeTraits, filterCmpFactories, btreeFields, - filterFields, true, metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadataFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadataFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadataFactory.java deleted file mode 100644 index 3100d6c..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMBTreeLocalResourceMetadataFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.transactions.Resource; -import org.apache.asterix.common.transactions.ResourceFactory; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; - -public class LSMBTreeLocalResourceMetadataFactory extends ResourceFactory { - - private static final long serialVersionUID = 1L; - protected final ITypeTraits[] typeTraits; - protected final IBinaryComparatorFactory[] cmpFactories; - protected final int[] bloomFilterKeyFields; - protected final boolean isPrimary; - protected final ILSMMergePolicyFactory mergePolicyFactory; - protected final Map<String, String> mergePolicyProperties; - protected final int[] btreeFields; - - public LSMBTreeLocalResourceMetadataFactory(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] cmpFactories, - int[] bloomFilterKeyFields, boolean isPrimary, int datasetID, - ILSMMergePolicyFactory mergePolicyFactory, - Map<String, String> mergePolicyProperties, ITypeTraits[] filterTypeTraits, - IBinaryComparatorFactory[] filterCmpFactories, int[] btreeFields, int[] filterFields, - ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, filterTypeTraits, filterCmpFactories, filterFields, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - this.typeTraits = typeTraits; - this.cmpFactories = cmpFactories; - this.bloomFilterKeyFields = bloomFilterKeyFields; - this.isPrimary = isPrimary; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.btreeFields = btreeFields; - } - - @Override - public Resource resource(int partition) { - return new LSMBTreeLocalResourceMetadata(typeTraits, cmpFactories, bloomFilterKeyFields, isPrimary, datasetId, - partition, mergePolicyFactory, mergePolicyProperties, typeTraits, filterCmpFactories, btreeFields, - filterFields, opTrackerProvider, ioOpCallbackFactory, metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java deleted file mode 100644 index d956647..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadata.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.List; -import java.util.Map; - -import org.apache.asterix.common.api.INcApplicationContext; -import org.apache.asterix.common.transactions.Resource; -import org.apache.hyracks.api.application.INCServiceContext; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.FileReference; -import org.apache.hyracks.api.io.IIOManager; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.util.InvertedIndexUtils; -import org.apache.hyracks.storage.common.file.LocalResource; - -public class LSMInvertedIndexLocalResourceMetadata extends Resource { - - private static final long serialVersionUID = 1L; - - private final ITypeTraits[] invListTypeTraits; - private final IBinaryComparatorFactory[] invListCmpFactories; - private final ITypeTraits[] tokenTypeTraits; - private final IBinaryComparatorFactory[] tokenCmpFactories; - private final IBinaryTokenizerFactory tokenizerFactory; - private final boolean isPartitioned; - private final ILSMMergePolicyFactory mergePolicyFactory; - private final Map<String, String> mergePolicyProperties; - private final int[] invertedIndexFields; - private final int[] filterFieldsForNonBulkLoadOps; - private final int[] invertedIndexFieldsForNonBulkLoadOps; - - public LSMInvertedIndexLocalResourceMetadata(ITypeTraits[] invListTypeTraits, - IBinaryComparatorFactory[] invListCmpFactories, ITypeTraits[] tokenTypeTraits, - IBinaryComparatorFactory[] tokenCmpFactories, IBinaryTokenizerFactory tokenizerFactory, - boolean isPartitioned, int datasetID, int partition, ILSMMergePolicyFactory mergePolicyFactory, - Map<String, String> mergePolicyProperties, ITypeTraits[] filterTypeTraits, - IBinaryComparatorFactory[] filterCmpFactories, int[] invertedIndexFields, int[] filterFields, - int[] filterFieldsForNonBulkLoadOps, int[] invertedIndexFieldsForNonBulkLoadOps, - ILSMOperationTrackerFactory opTrackerProvider, ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, partition, filterTypeTraits, filterCmpFactories, filterFields, opTrackerProvider, - ioOpCallbackFactory, metadataPageManagerFactory); - this.invListTypeTraits = invListTypeTraits; - this.invListCmpFactories = invListCmpFactories; - this.tokenTypeTraits = tokenTypeTraits; - this.tokenCmpFactories = tokenCmpFactories; - this.tokenizerFactory = tokenizerFactory; - this.isPartitioned = isPartitioned; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.invertedIndexFields = invertedIndexFields; - this.filterFieldsForNonBulkLoadOps = filterFieldsForNonBulkLoadOps; - this.invertedIndexFieldsForNonBulkLoadOps = invertedIndexFieldsForNonBulkLoadOps; - } - - @Override - public ILSMIndex createIndexInstance(INCServiceContext serviceCtx, LocalResource resource) - throws HyracksDataException { - INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext(); - IIOManager ioManager = appCtx.getIOManager(); - FileReference file = ioManager.resolve(resource.getPath()); - int ioDeviceNum = Resource.getIoDeviceNum(ioManager, file.getDeviceHandle()); - List<IVirtualBufferCache> virtualBufferCaches = - appCtx.getDatasetLifecycleManager().getVirtualBufferCaches(datasetId(), ioDeviceNum); - if (isPartitioned) { - return InvertedIndexUtils.createPartitionedLSMInvertedIndex(ioManager, virtualBufferCaches, - appCtx.getFileMapManager(), invListTypeTraits, invListCmpFactories, tokenTypeTraits, - tokenCmpFactories, tokenizerFactory, appCtx.getBufferCache(), file.getAbsolutePath(), - appCtx.getBloomFilterFalsePositiveRate(), - mergePolicyFactory.createMergePolicy(mergePolicyProperties, appCtx.getDatasetLifecycleManager()), - opTrackerProvider.getOperationTracker(serviceCtx), appCtx.getLSMIOScheduler(), - ioOpCallbackFactory.createIoOpCallback(), invertedIndexFields, filterTypeTraits, filterCmpFactories, - filterFields, filterFieldsForNonBulkLoadOps, invertedIndexFieldsForNonBulkLoadOps, true, - metadataPageManagerFactory); - } else { - return InvertedIndexUtils.createLSMInvertedIndex(ioManager, virtualBufferCaches, appCtx.getFileMapManager(), - invListTypeTraits, invListCmpFactories, tokenTypeTraits, tokenCmpFactories, tokenizerFactory, - appCtx.getBufferCache(), file.getAbsolutePath(), appCtx.getBloomFilterFalsePositiveRate(), - mergePolicyFactory.createMergePolicy(mergePolicyProperties, appCtx.getDatasetLifecycleManager()), - opTrackerProvider.getOperationTracker(serviceCtx), appCtx.getLSMIOScheduler(), - ioOpCallbackFactory.createIoOpCallback(), invertedIndexFields, filterTypeTraits, filterCmpFactories, - filterFields, filterFieldsForNonBulkLoadOps, invertedIndexFieldsForNonBulkLoadOps, true, - metadataPageManagerFactory); - } - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadataFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadataFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadataFactory.java deleted file mode 100644 index 2d55357..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMInvertedIndexLocalResourceMetadataFactory.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.transactions.Resource; -import org.apache.asterix.common.transactions.ResourceFactory; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory; - -public class LSMInvertedIndexLocalResourceMetadataFactory extends ResourceFactory { - - private static final long serialVersionUID = 1L; - private final ITypeTraits[] invListTypeTraits; - private final IBinaryComparatorFactory[] invListCmpFactories; - private final ITypeTraits[] tokenTypeTraits; - private final IBinaryComparatorFactory[] tokenCmpFactories; - private final IBinaryTokenizerFactory tokenizerFactory; - private final boolean isPartitioned; - private final ILSMMergePolicyFactory mergePolicyFactory; - private final Map<String, String> mergePolicyProperties; - private final int[] invertedIndexFields; - private final int[] filterFieldsForNonBulkLoadOps; - private final int[] invertedIndexFieldsForNonBulkLoadOps; - - public LSMInvertedIndexLocalResourceMetadataFactory(ITypeTraits[] invListTypeTraits, - IBinaryComparatorFactory[] invListCmpFactories, ITypeTraits[] tokenTypeTraits, - IBinaryComparatorFactory[] tokenCmpFactories, IBinaryTokenizerFactory tokenizerFactory, - boolean isPartitioned, int datasetID, ILSMMergePolicyFactory mergePolicyFactory, - Map<String, String> mergePolicyProperties, ITypeTraits[] filterTypeTraits, - IBinaryComparatorFactory[] filterCmpFactories, int[] invertedIndexFields, int[] filterFields, - int[] filterFieldsForNonBulkLoadOps, int[] invertedIndexFieldsForNonBulkLoadOps, - ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, filterTypeTraits, filterCmpFactories, filterFields, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - this.invListTypeTraits = invListTypeTraits; - this.invListCmpFactories = invListCmpFactories; - this.tokenTypeTraits = tokenTypeTraits; - this.tokenCmpFactories = tokenCmpFactories; - this.tokenizerFactory = tokenizerFactory; - this.isPartitioned = isPartitioned; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.invertedIndexFields = invertedIndexFields; - this.filterFieldsForNonBulkLoadOps = filterFieldsForNonBulkLoadOps; - this.invertedIndexFieldsForNonBulkLoadOps = invertedIndexFieldsForNonBulkLoadOps; - } - - @Override - public Resource resource(int partition) { - return new LSMInvertedIndexLocalResourceMetadata(invListTypeTraits, invListCmpFactories, tokenTypeTraits, - tokenCmpFactories, tokenizerFactory, isPartitioned, datasetId, partition, mergePolicyFactory, - mergePolicyProperties, filterTypeTraits, filterCmpFactories, invertedIndexFields, - filterFields, filterFieldsForNonBulkLoadOps, invertedIndexFieldsForNonBulkLoadOps, opTrackerProvider, - ioOpCallbackFactory, metadataPageManagerFactory); - } - -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java deleted file mode 100644 index f3ac6c1..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadata.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.List; -import java.util.Map; - -import org.apache.asterix.common.api.INcApplicationContext; -import org.apache.asterix.common.transactions.Resource; -import org.apache.hyracks.api.application.INCServiceContext; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ILinearizeComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.api.exceptions.HyracksDataException; -import org.apache.hyracks.api.io.FileReference; -import org.apache.hyracks.api.io.IIOManager; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.am.lsm.common.api.IVirtualBufferCache; -import org.apache.hyracks.storage.am.lsm.rtree.utils.LSMRTreeUtils; -import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; -import org.apache.hyracks.storage.common.file.LocalResource; - -public class LSMRTreeLocalResourceMetadata extends Resource { - - private static final long serialVersionUID = 1L; - - protected final ITypeTraits[] typeTraits; - protected final IBinaryComparatorFactory[] rtreeCmpFactories; - protected final IBinaryComparatorFactory[] btreeCmpFactories; - protected final IPrimitiveValueProviderFactory[] valueProviderFactories; - protected final RTreePolicyType rtreePolicyType; - protected final ILinearizeComparatorFactory linearizeCmpFactory; - protected final ILSMMergePolicyFactory mergePolicyFactory; - protected final Map<String, String> mergePolicyProperties; - protected final int[] rtreeFields; - protected final int[] btreeFields; - protected final boolean isPointMBR; - - public LSMRTreeLocalResourceMetadata(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] rtreeCmpFactories, - IBinaryComparatorFactory[] btreeCmpFactories, IPrimitiveValueProviderFactory[] valueProviderFactories, - RTreePolicyType rtreePolicyType, ILinearizeComparatorFactory linearizeCmpFactory, int datasetID, - int partition, ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, - ITypeTraits[] filterTypeTraits, IBinaryComparatorFactory[] filterCmpFactories, int[] rtreeFields, - int[] btreeFields, int[] filterFields, boolean isPointMBR, ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, partition, filterTypeTraits, filterCmpFactories, filterFields, opTrackerProvider, - ioOpCallbackFactory, metadataPageManagerFactory); - this.typeTraits = typeTraits; - this.rtreeCmpFactories = rtreeCmpFactories; - this.btreeCmpFactories = btreeCmpFactories; - this.valueProviderFactories = valueProviderFactories; - this.rtreePolicyType = rtreePolicyType; - this.linearizeCmpFactory = linearizeCmpFactory; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.rtreeFields = rtreeFields; - this.btreeFields = btreeFields; - this.isPointMBR = isPointMBR; - } - - @Override - public ILSMIndex createIndexInstance(INCServiceContext serviceCtx, LocalResource resource) - throws HyracksDataException { - INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext(); - IIOManager ioManager = appCtx.getIOManager(); - FileReference file = ioManager.resolve(resource.getPath()); - int ioDeviceNum = Resource.getIoDeviceNum(ioManager, file.getDeviceHandle()); - List<IVirtualBufferCache> virtualBufferCaches = - appCtx.getDatasetLifecycleManager().getVirtualBufferCaches(datasetId(), ioDeviceNum); - return LSMRTreeUtils.createLSMTreeWithAntiMatterTuples(ioManager, virtualBufferCaches, file, - appCtx.getBufferCache(), appCtx.getFileMapManager(), typeTraits, rtreeCmpFactories, btreeCmpFactories, - valueProviderFactories, rtreePolicyType, - mergePolicyFactory.createMergePolicy(mergePolicyProperties, appCtx.getDatasetLifecycleManager()), - opTrackerProvider.getOperationTracker(serviceCtx), appCtx.getLSMIOScheduler(), - ioOpCallbackFactory.createIoOpCallback(), linearizeCmpFactory, rtreeFields, filterTypeTraits, - filterCmpFactories, filterFields, true, isPointMBR, metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadataFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadataFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadataFactory.java deleted file mode 100644 index f05d28a..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/LSMRTreeLocalResourceMetadataFactory.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import java.util.Map; - -import org.apache.asterix.common.transactions.Resource; -import org.apache.asterix.common.transactions.ResourceFactory; -import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ILinearizeComparatorFactory; -import org.apache.hyracks.api.dataflow.value.ITypeTraits; -import org.apache.hyracks.storage.am.common.api.IMetadataPageManagerFactory; -import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallbackFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMMergePolicyFactory; -import org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTrackerFactory; -import org.apache.hyracks.storage.am.rtree.frames.RTreePolicyType; - -public class LSMRTreeLocalResourceMetadataFactory extends ResourceFactory { - - private static final long serialVersionUID = 1L; - - protected final ITypeTraits[] typeTraits; - protected final IBinaryComparatorFactory[] rtreeCmpFactories; - protected final IBinaryComparatorFactory[] btreeCmpFactories; - protected final IPrimitiveValueProviderFactory[] valueProviderFactories; - protected final RTreePolicyType rtreePolicyType; - protected final ILinearizeComparatorFactory linearizeCmpFactory; - protected final ILSMMergePolicyFactory mergePolicyFactory; - protected final Map<String, String> mergePolicyProperties; - protected final int[] rtreeFields; - protected final int[] btreeFields; - protected final boolean isPointMBR; - - public LSMRTreeLocalResourceMetadataFactory(ITypeTraits[] typeTraits, IBinaryComparatorFactory[] rtreeCmpFactories, - IBinaryComparatorFactory[] btreeCmpFactories, IPrimitiveValueProviderFactory[] valueProviderFactories, - RTreePolicyType rtreePolicyType, ILinearizeComparatorFactory linearizeCmpFactory, int datasetID, - ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, - ITypeTraits[] filterTypeTraits, IBinaryComparatorFactory[] filterCmpFactories, int[] rtreeFields, - int[] btreeFields, int[] filterFields, boolean isPointMBR, ILSMOperationTrackerFactory opTrackerProvider, - ILSMIOOperationCallbackFactory ioOpCallbackFactory, - IMetadataPageManagerFactory metadataPageManagerFactory) { - super(datasetID, filterTypeTraits, filterCmpFactories, filterFields, opTrackerProvider, ioOpCallbackFactory, - metadataPageManagerFactory); - this.typeTraits = typeTraits; - this.rtreeCmpFactories = rtreeCmpFactories; - this.btreeCmpFactories = btreeCmpFactories; - this.valueProviderFactories = valueProviderFactories; - this.rtreePolicyType = rtreePolicyType; - this.linearizeCmpFactory = linearizeCmpFactory; - this.mergePolicyFactory = mergePolicyFactory; - this.mergePolicyProperties = mergePolicyProperties; - this.rtreeFields = rtreeFields; - this.btreeFields = btreeFields; - this.isPointMBR = isPointMBR; - } - - @Override - public Resource resource(int partition) { - return new LSMRTreeLocalResourceMetadata(typeTraits, rtreeCmpFactories, btreeCmpFactories, - valueProviderFactories, rtreePolicyType, linearizeCmpFactory, datasetId, partition, mergePolicyFactory, - mergePolicyProperties, filterTypeTraits, filterCmpFactories, rtreeFields, btreeFields, filterFields, - isPointMBR, opTrackerProvider, ioOpCallbackFactory, metadataPageManagerFactory); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactory.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactory.java deleted file mode 100644 index 8ab99fb..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import org.apache.asterix.common.transactions.IResourceFactory; -import org.apache.asterix.common.transactions.Resource; -import org.apache.hyracks.storage.common.file.ILocalResourceFactory; -import org.apache.hyracks.storage.common.file.LocalResource; - -public class PersistentLocalResourceFactory implements ILocalResourceFactory { - - private final IResourceFactory applicationResourceFactory; - private final int resourceType; - - public PersistentLocalResourceFactory(IResourceFactory applicationResourceFactory, int resourceType) { - this.applicationResourceFactory = applicationResourceFactory; - this.resourceType = resourceType; - } - - @Override - public LocalResource createLocalResource(long id, String name, int version, int partition) { - Resource resource = applicationResourceFactory.resource(partition); - return new LocalResource(id, name, resourceType, version, resource); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/735532e4/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactoryProvider.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactoryProvider.java b/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactoryProvider.java deleted file mode 100644 index c306699..0000000 --- a/asterixdb/asterix-transactions/src/main/java/org/apache/asterix/transaction/management/resource/PersistentLocalResourceFactoryProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.asterix.transaction.management.resource; - -import org.apache.asterix.common.transactions.IResourceFactory; -import org.apache.hyracks.storage.common.file.ILocalResourceFactory; -import org.apache.hyracks.storage.common.file.ILocalResourceFactoryProvider; - -public class PersistentLocalResourceFactoryProvider implements ILocalResourceFactoryProvider { - - private static final long serialVersionUID = 1L; - private final IResourceFactory factory; - private final int type; - - public PersistentLocalResourceFactoryProvider(IResourceFactory factory, int type) { - this.factory = factory; - this.type = type; - } - - @Override - public ILocalResourceFactory getLocalResourceFactory() { - return new PersistentLocalResourceFactory(factory, type); - } -}