added a mechanism to set resourceId to operationCallback
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1595 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IOperationCallbackProvider.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IOperationCallbackProvider.java
index 98e297f..d3919e3 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IOperationCallbackProvider.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IOperationCallbackProvider.java
@@ -3,7 +3,7 @@
import java.io.Serializable;
public interface IOperationCallbackProvider extends Serializable {
- public IModificationOperationCallback getModificationOperationCallback();
+ public IModificationOperationCallback getModificationOperationCallback(long resourceId);
- public ISearchOperationCallback getSearchOperationCallback();
+ public ISearchOperationCallback getSearchOperationCallback(long resourceId);
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
index 9d45cb2..3f2df81 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
@@ -24,7 +24,9 @@
import edu.uci.ics.hyracks.api.io.IIOManager;
import edu.uci.ics.hyracks.api.io.IODeviceHandle;
import edu.uci.ics.hyracks.dataflow.std.file.IFileSplitProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
+import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
import edu.uci.ics.hyracks.storage.common.file.IIndexArtifactMap;
@@ -36,6 +38,8 @@
protected final int partition;
protected final IIndexOperatorDescriptor opDesc;
protected final IHyracksTaskContext ctx;
+ protected transient IModificationOperationCallback modificationOperationCallback;
+ protected transient ISearchOperationCallback searchOperationCallback;
public IndexDataflowHelper(IIndexOperatorDescriptor opDesc, final IHyracksTaskContext ctx, int partition) {
this.opDesc = opDesc;
@@ -115,6 +119,10 @@
indexRegistry.register(resourceId, index);
}
}
+
+ //set operationCallback object
+ modificationOperationCallback = opDesc.getOpCallbackProvider().getModificationOperationCallback(resourceId);
+ searchOperationCallback = opDesc.getOpCallbackProvider().getSearchOperationCallback(resourceId);
}
public abstract IIndex createIndexInstance() throws HyracksDataException;
@@ -151,4 +159,13 @@
public IOperationCallbackProvider getOpCallbackProvider() {
return opDesc.getOpCallbackProvider();
}
+
+ public IModificationOperationCallback getModificationOperationCallback() {
+ return modificationOperationCallback;
+ }
+
+ public ISearchOperationCallback getSearchOperationCallback() {
+ return searchOperationCallback;
+ }
+
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
index eb47db7..33796e6 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexDiskOrderScanOperatorNodePushable.java
@@ -24,7 +24,6 @@
import edu.uci.ics.hyracks.dataflow.common.comm.util.FrameUtils;
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
import edu.uci.ics.hyracks.dataflow.std.base.AbstractUnaryOutputSourceOperatorNodePushable;
-import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexAccessor;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
@@ -33,13 +32,11 @@
public class TreeIndexDiskOrderScanOperatorNodePushable extends AbstractUnaryOutputSourceOperatorNodePushable {
private final TreeIndexDataflowHelper treeIndexHelper;
private ITreeIndex treeIndex;
- private final IOperationCallbackProvider callbackProvider;
public TreeIndexDiskOrderScanOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc,
IHyracksTaskContext ctx, int partition) {
treeIndexHelper = (TreeIndexDataflowHelper) opDesc.getIndexDataflowHelperFactory().createIndexDataflowHelper(
opDesc, ctx, partition);
- this.callbackProvider = opDesc.getOpCallbackProvider();
}
@Override
@@ -50,7 +47,7 @@
ITreeIndexFrame cursorFrame = treeIndex.getLeafFrameFactory().createFrame();
ITreeIndexCursor cursor = treeIndexHelper.createDiskOrderScanCursor(cursorFrame);
ITreeIndexAccessor indexAccessor = (ITreeIndexAccessor) treeIndex.createAccessor(
- callbackProvider.getModificationOperationCallback(), callbackProvider.getSearchOperationCallback());
+ treeIndexHelper.getModificationOperationCallback(), treeIndexHelper.getSearchOperationCallback());
writer.open();
try {
indexAccessor.diskOrderScan(cursor);
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java
index 07d63d8..3933de6 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexInsertUpdateDeleteOperatorNodePushable.java
@@ -26,7 +26,6 @@
import edu.uci.ics.hyracks.dataflow.std.base.AbstractUnaryInputUnaryOutputOperatorNodePushable;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexAccessor;
import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
-import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilter;
import edu.uci.ics.hyracks.storage.am.common.api.ITupleFilterFactory;
@@ -42,7 +41,6 @@
private ByteBuffer writeBuffer;
private IIndexAccessor indexAccessor;
private ITupleFilter tupleFilter;
- private final IOperationCallbackProvider callbackProvider;
public TreeIndexInsertUpdateDeleteOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc,
IHyracksTaskContext ctx, int partition, int[] fieldPermutation,
@@ -51,7 +49,6 @@
opDesc, ctx, partition);
this.recordDescProvider = recordDescProvider;
this.op = op;
- this.callbackProvider = opDesc.getOpCallbackProvider();
tuple.setFieldPermutation(fieldPermutation);
}
@@ -66,8 +63,8 @@
try {
treeIndexHelper.init(false);
ITreeIndex treeIndex = (ITreeIndex) treeIndexHelper.getIndex();
- indexAccessor = treeIndex.createAccessor(callbackProvider.getModificationOperationCallback(),
- callbackProvider.getSearchOperationCallback());
+ indexAccessor = treeIndex.createAccessor(treeIndexHelper.getModificationOperationCallback(),
+ treeIndexHelper.getSearchOperationCallback());
ITupleFilterFactory tupleFilterFactory = opDesc.getTupleFilterFactory();
if (tupleFilterFactory != null) {
tupleFilter = tupleFilterFactory.createTupleFilter();
@@ -93,7 +90,7 @@
}
}
tuple.reset(accessor, i);
- IModificationOperationCallback modificationCallback = callbackProvider
+ IModificationOperationCallback modificationCallback = treeIndexHelper
.getModificationOperationCallback();
modificationCallback.before(tuple);
switch (op) {
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexSearchOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexSearchOperatorNodePushable.java
index c0217c3..fd44311 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexSearchOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexSearchOperatorNodePushable.java
@@ -29,7 +29,6 @@
import edu.uci.ics.hyracks.dataflow.std.base.AbstractUnaryInputUnaryOutputOperatorNodePushable;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexAccessor;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexCursor;
-import edu.uci.ics.hyracks.storage.am.common.api.IOperationCallbackProvider;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrame;
@@ -51,14 +50,11 @@
protected RecordDescriptor recDesc;
- private final IOperationCallbackProvider callbackProvider;
-
public TreeIndexSearchOperatorNodePushable(AbstractTreeIndexOperatorDescriptor opDesc, IHyracksTaskContext ctx,
int partition, IRecordDescriptorProvider recordDescProvider) {
treeIndexHelper = (TreeIndexDataflowHelper) opDesc.getIndexDataflowHelperFactory().createIndexDataflowHelper(
opDesc, ctx, partition);
this.recDesc = recordDescProvider.getInputRecordDescriptor(opDesc.getOperatorId(), 0);
- this.callbackProvider = opDesc.getOpCallbackProvider();
}
protected abstract ISearchPredicate createSearchPredicate();
@@ -83,8 +79,8 @@
dos = tb.getDataOutput();
appender = new FrameTupleAppender(treeIndexHelper.getHyracksTaskContext().getFrameSize());
appender.reset(writeBuffer, true);
- indexAccessor = treeIndex.createAccessor(callbackProvider.getModificationOperationCallback(),
- callbackProvider.getSearchOperationCallback());
+ indexAccessor = treeIndex.createAccessor(treeIndexHelper.getModificationOperationCallback(),
+ treeIndexHelper.getSearchOperationCallback());
cursor = createCursor();
} catch (Exception e) {
treeIndexHelper.deinit();
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/NoOpOperationCallbackProvider.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/NoOpOperationCallbackProvider.java
index bda1f69..102beec 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/NoOpOperationCallbackProvider.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/NoOpOperationCallbackProvider.java
@@ -14,12 +14,12 @@
INSTANCE;
@Override
- public IModificationOperationCallback getModificationOperationCallback() {
+ public IModificationOperationCallback getModificationOperationCallback(long resourceId) {
return NoOpOperationCallback.INSTANCE;
}
@Override
- public ISearchOperationCallback getSearchOperationCallback() {
+ public ISearchOperationCallback getSearchOperationCallback(long resourceId) {
return NoOpOperationCallback.INSTANCE;
}
}
diff --git a/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/storage/am/config/AccessMethodTestsConfig.java b/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/storage/am/config/AccessMethodTestsConfig.java
index 73ada0e..1b10a2b 100644
--- a/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/storage/am/config/AccessMethodTestsConfig.java
+++ b/hyracks-test-support/src/main/java/edu/uci/ics/hyracks/storage/am/config/AccessMethodTestsConfig.java
@@ -20,10 +20,10 @@
*/
public class AccessMethodTestsConfig {
// Test params for RTree, LSMRTree and LSMRTreeWithAntiMatterTuples.
- public static final int RTREE_NUM_TUPLES_TO_INSERT = 10000;
+ public static final int RTREE_NUM_TUPLES_TO_INSERT = 1000;
public static final int RTREE_NUM_INSERT_ROUNDS = 2;
public static final int RTREE_NUM_DELETE_ROUNDS = 2;
- public static final int RTREE_MULTITHREAD_NUM_OPERATIONS = 10000;
+ public static final int RTREE_MULTITHREAD_NUM_OPERATIONS = 1000;
// Test params for LSMRTree and LSMRTreeWithAntiMatterTuples.
public static final int LSM_RTREE_BULKLOAD_ROUNDS = 5;
public static final int LSM_RTREE_MAX_TREES_TO_MERGE = 3;