Removed unused package edu.uci.ics.hyracks.storage.am.common.lifecycle;
Removed usesless IndexType class;
Removed duplicate copy of IExperimentRunner;
Removed getIOManager() call from ILSMIndexFileManager;
IIndexOperationContext: startOperation() --rename--> setOperation();
Changed ILSMIOOperationScheduler.scheduleOperation() to throw HyracksDataException;
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1946 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
index 4d3f82f..f48032b 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTree.java
@@ -50,7 +50,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.api.UnsortedInputException;
import edu.uci.ics.hyracks.storage.am.common.frames.FrameOpSpaceStatus;
@@ -769,11 +768,6 @@
.getMetaDataFrameFactory().createFrame(), cmpFactories, modificationCallback, searchCallback);
}
- @Override
- public IndexType getIndexType() {
- return IndexType.BTREE;
- }
-
@SuppressWarnings("rawtypes")
public String printTree(IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame,
ISerializerDeserializer[] keySerdes) throws Exception {
@@ -849,19 +843,19 @@
@Override
public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
- ctx.startOperation(IndexOperation.INSERT);
+ ctx.setOperation(IndexOperation.INSERT);
btree.insert(tuple, ctx);
}
@Override
public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
- ctx.startOperation(IndexOperation.UPDATE);
+ ctx.setOperation(IndexOperation.UPDATE);
btree.update(tuple, ctx);
}
@Override
public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
- ctx.startOperation(IndexOperation.DELETE);
+ ctx.setOperation(IndexOperation.DELETE);
btree.delete(tuple, ctx);
}
@@ -872,7 +866,7 @@
public void upsertIfConditionElseInsert(ITupleReference tuple, ITupleAcceptor acceptor)
throws HyracksDataException, TreeIndexException {
- ctx.startOperation(IndexOperation.UPSERT);
+ ctx.setOperation(IndexOperation.UPSERT);
ctx.acceptor = acceptor;
btree.upsert(tuple, ctx);
}
@@ -886,7 +880,7 @@
@Override
public void search(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException,
TreeIndexException {
- ctx.startOperation(IndexOperation.SEARCH);
+ ctx.setOperation(IndexOperation.SEARCH);
btree.search((ITreeIndexCursor) cursor, searchPred, ctx);
}
@@ -898,7 +892,7 @@
@Override
public void diskOrderScan(ITreeIndexCursor cursor) throws HyracksDataException {
- ctx.startOperation(IndexOperation.DISKORDERSCAN);
+ ctx.setOperation(IndexOperation.DISKORDERSCAN);
btree.diskOrderScan(cursor, ctx);
}
@@ -908,7 +902,7 @@
public BTreeOpContext getOpContext() {
return ctx;
}
-
+
public ITreeIndexCursor createCountingSearchCursor() {
IBTreeLeafFrame leafFrame = (IBTreeLeafFrame) btree.getLeafFrameFactory().createFrame();
return new BTreeCountingSearchCursor(leafFrame, false);
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java
index c07dad4..31557cf 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/impls/BTreeOpContext.java
@@ -111,7 +111,7 @@
}
@Override
- public void startOperation(IndexOperation newOp) {
+ public void setOperation(IndexOperation newOp) {
if (newOp == IndexOperation.SEARCH || newOp == IndexOperation.DISKORDERSCAN) {
if (cursorInitialState == null) {
cursorInitialState = new BTreeCursorInitialState(null, searchCallback, accessor);
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndex.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndex.java
index 23dde7d..d6d74ee 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndex.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndex.java
@@ -115,15 +115,10 @@
public IBufferCache getBufferCache();
/**
- * @return the {@link IndexType} of this index.
- */
- public IndexType getIndexType();
-
- /**
* @return the size, in bytes, of pre-allocated memory space that this index was allotted.
*/
- public long getInMemorySize();
-
+ public long getMemoryAllocationSize();
+
/**
* @param fillFactor
* @param verifyInput
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndexOperationContext.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndexOperationContext.java
index 2297c41..df76345 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndexOperationContext.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IIndexOperationContext.java
@@ -3,7 +3,7 @@
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
public interface IIndexOperationContext {
- void startOperation(IndexOperation newOp);
+ void setOperation(IndexOperation newOp);
void reset();
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IndexType.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IndexType.java
deleted file mode 100644
index 6f83e0b..0000000
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IndexType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package edu.uci.ics.hyracks.storage.am.common.api;
-
-public enum IndexType {
- BTREE, RTREE, INVERTED
-}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java
index 2183c9d..a0189c2 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/IndexLifecycleManager.java
@@ -33,7 +33,7 @@
}
info.index.deactivate();
- memoryUsed -= info.index.getInMemorySize();
+ memoryUsed -= info.index.getMemoryAllocationSize();
info.isOpen = false;
return true;
@@ -68,7 +68,7 @@
if (info.isOpen) {
info.index.deactivate();
- memoryUsed -= info.index.getInMemorySize();
+ memoryUsed -= info.index.getMemoryAllocationSize();
}
}
@@ -80,7 +80,7 @@
+ " since it does not exist.");
}
- long inMemorySize = info.index.getInMemorySize();
+ long inMemorySize = info.index.getMemoryAllocationSize();
while (memoryUsed + inMemorySize > memoryBudget) {
if (!evictCandidateIndex()) {
throw new HyracksDataException("Cannot activate index since memory budget would be exceeded.");
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/AbstractTreeIndex.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/AbstractTreeIndex.java
index 63de21d..b6da610 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/AbstractTreeIndex.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/impls/AbstractTreeIndex.java
@@ -345,7 +345,7 @@
}
@Override
- public long getInMemorySize() {
+ public long getMemoryAllocationSize() {
return 0;
}
}
diff --git a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
index 3bd6583..cc53b61 100644
--- a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
+++ b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTree.java
@@ -43,7 +43,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
@@ -212,8 +211,8 @@
}
@Override
- public boolean insertUpdateOrDelete(ITupleReference tuple, IIndexOperationContext ictx) throws HyracksDataException,
- IndexException {
+ public boolean insertUpdateOrDelete(ITupleReference tuple, IIndexOperationContext ictx)
+ throws HyracksDataException, IndexException {
LSMBTreeOpContext ctx = (LSMBTreeOpContext) ictx;
switch (ctx.getIndexOp()) {
@@ -322,8 +321,9 @@
return diskBTree;
}
- public void search(IIndexCursor cursor, List<Object> diskComponents, ISearchPredicate pred, IIndexOperationContext ictx,
- boolean includeMemComponent, AtomicInteger searcherRefCount) throws HyracksDataException, IndexException {
+ public void search(IIndexCursor cursor, List<Object> diskComponents, ISearchPredicate pred,
+ IIndexOperationContext ictx, boolean includeMemComponent, AtomicInteger searcherRefCount)
+ throws HyracksDataException, IndexException {
LSMBTreeOpContext ctx = (LSMBTreeOpContext) ictx;
LSMBTreeRangeSearchCursor lsmTreeCursor = (LSMBTreeRangeSearchCursor) cursor;
int numDiskBTrees = diskComponents.size();
@@ -485,11 +485,6 @@
}
@Override
- public IndexType getIndexType() {
- return memBTree.getIndexType();
- }
-
- @Override
public int getFileId() {
return memBTree.getFileId();
}
@@ -600,7 +595,7 @@
}
@Override
- public long getInMemorySize() {
+ public long getMemoryAllocationSize() {
InMemoryBufferCache memBufferCache = (InMemoryBufferCache) memBTree.getBufferCache();
return memBufferCache.getNumPages() * memBufferCache.getPageSize();
}
diff --git a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
index b3e0237..80190bf 100644
--- a/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
+++ b/hyracks-storage-am-lsm-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/btree/impls/LSMBTreeOpContext.java
@@ -60,7 +60,7 @@
}
@Override
- public void startOperation(IndexOperation newOp) {
+ public void setOperation(IndexOperation newOp) {
this.op = newOp;
switch (newOp) {
case SEARCH:
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/IExperimentRunner.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/IExperimentRunner.java
deleted file mode 100644
index 94d8d1e..0000000
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/IExperimentRunner.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2009-2012 by The Regents of the University of California
- * Licensed 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 from
- *
- * 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 edu.uci.ics.hyracks.storage.am.lsm.common.api;
-
-import edu.uci.ics.hyracks.storage.am.common.datagen.DataGenThread;
-
-public interface IExperimentRunner {
- public static int DEFAULT_MAX_OUTSTANDING = 100000;
-
- public void init() throws Exception;
-
- public long runExperiment(DataGenThread dataGen, int numThreads) throws Exception;
-
- public void reset() throws Exception;
-
- public void deinit() throws Exception;
-}
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIOOperationScheduler.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIOOperationScheduler.java
index fe81203..6d96562 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIOOperationScheduler.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIOOperationScheduler.java
@@ -1,6 +1,7 @@
package edu.uci.ics.hyracks.storage.am.lsm.common.api;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
public interface ILSMIOOperationScheduler {
- public void scheduleOperation(ILSMIOOperation operation);
+ public void scheduleOperation(ILSMIOOperation operation) throws HyracksDataException;
}
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIndexFileManager.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIndexFileManager.java
index 2dd8146..9320053 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIndexFileManager.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMIndexFileManager.java
@@ -20,7 +20,6 @@
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.api.io.FileReference;
-import edu.uci.ics.hyracks.api.io.IIOManager;
/**
* Provides file names for LSM on-disk components. Also cleans up invalid files.
@@ -49,6 +48,4 @@
public List<Object> cleanupAndGetValidFiles(ILSMComponentFinalizer componentFinalizer) throws HyracksDataException;
public Comparator<String> getFileNameComparator();
-
- public IIOManager getIOManager();
}
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java
index 470c189..0cc27f4 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMIndexFileManager.java
@@ -260,9 +260,4 @@
return -a.interval[1].compareTo(b.interval[1]);
}
}
-
- @Override
- public IIOManager getIOManager() {
- return ioManager;
- }
}
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java
index 85fe014..797e250 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMTreeIndexAccessor.java
@@ -37,32 +37,32 @@
@Override
public void insert(ITupleReference tuple) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.INSERT);
+ ctx.setOperation(IndexOperation.INSERT);
lsmHarness.insertUpdateOrDelete(tuple, ctx);
}
@Override
public void update(ITupleReference tuple) throws HyracksDataException, IndexException {
// Update is the same as insert.
- ctx.startOperation(IndexOperation.UPDATE);
+ ctx.setOperation(IndexOperation.UPDATE);
lsmHarness.insertUpdateOrDelete(tuple, ctx);
}
@Override
public void delete(ITupleReference tuple) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.DELETE);
+ ctx.setOperation(IndexOperation.DELETE);
lsmHarness.insertUpdateOrDelete(tuple, ctx);
}
@Override
public void upsert(ITupleReference tuple) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.UPSERT);
+ ctx.setOperation(IndexOperation.UPSERT);
lsmHarness.insertUpdateOrDelete(tuple, ctx);
}
@Override
public void search(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.SEARCH);
+ ctx.setOperation(IndexOperation.SEARCH);
lsmHarness.search(cursor, searchPred, ctx, true);
}
@@ -78,7 +78,7 @@
@Override
public void physicalDelete(ITupleReference tuple) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.PHYSICALDELETE);
+ ctx.setOperation(IndexOperation.PHYSICALDELETE);
lsmHarness.insertUpdateOrDelete(tuple, ctx);
}
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/ReferenceCountingOperationTracker.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/ReferenceCountingOperationTracker.java
index a9f4d6d..5c0d575 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/ReferenceCountingOperationTracker.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/ReferenceCountingOperationTracker.java
@@ -32,7 +32,7 @@
}
@Override
- public void threadExit(final ILSMIndex index) {
+ public void threadExit(final ILSMIndex index) throws HyracksDataException {
synchronized (this) {
threadRefCount--;
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
index 8c60f9f..9c251d7 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndex.java
@@ -41,7 +41,6 @@
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.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
@@ -76,7 +75,7 @@
import edu.uci.ics.hyracks.storage.common.file.IFileMapProvider;
public class LSMInvertedIndex implements ILSMIndex, IInvertedIndex {
- public class LSMInvertedIndexComponent {
+ public class LSMInvertedIndexComponent {
private final IInvertedIndex invIndex;
private final BTree deletedKeysBTree;
@@ -93,16 +92,16 @@
return deletedKeysBTree;
}
}
-
+
protected final LSMHarness lsmHarness;
-
+
// In-memory components.
protected final LSMInvertedIndexComponent memComponent;
protected final IBufferCache memBufferCache;
protected final InMemoryFreePageManager memFreePageManager;
protected final IBinaryTokenizerFactory tokenizerFactory;
protected FileReference memDeleteKeysBTreeFile = new FileReference(new File("membtree"));
-
+
// On-disk components.
protected final ILSMIndexFileManager fileManager;
// For creating inverted indexes in flush and merge.
@@ -116,18 +115,18 @@
protected final LinkedList<Object> diskComponents = new LinkedList<Object>();
// Helps to guarantees physical consistency of LSM components.
protected final ILSMComponentFinalizer componentFinalizer;
-
+
// Type traits and comparators for tokens and inverted-list elements.
protected final ITypeTraits[] invListTypeTraits;
protected final IBinaryComparatorFactory[] invListCmpFactories;
protected final ITypeTraits[] tokenTypeTraits;
protected final IBinaryComparatorFactory[] tokenCmpFactories;
-
+
private boolean isActivated = false;
public LSMInvertedIndex(IBufferCache memBufferCache, InMemoryFreePageManager memFreePageManager,
- OnDiskInvertedIndexFactory diskInvIndexFactory, BTreeFactory deletedKeysBTreeFactory, ILSMIndexFileManager fileManager,
- IFileMapProvider diskFileMapProvider, ITypeTraits[] invListTypeTraits,
+ OnDiskInvertedIndexFactory diskInvIndexFactory, BTreeFactory deletedKeysBTreeFactory,
+ ILSMIndexFileManager fileManager, IFileMapProvider diskFileMapProvider, ITypeTraits[] invListTypeTraits,
IBinaryComparatorFactory[] invListCmpFactories, ITypeTraits[] tokenTypeTraits,
IBinaryComparatorFactory[] tokenCmpFactories, IBinaryTokenizerFactory tokenizerFactory,
ILSMFlushController flushController, ILSMMergePolicy mergePolicy, ILSMOperationTracker opTracker,
@@ -195,7 +194,8 @@
}
}
- protected IInvertedIndex createDiskInvIndex(OnDiskInvertedIndexFactory invIndexFactory, FileReference dictBTreeFileRef, boolean create) throws HyracksDataException, IndexException {
+ protected IInvertedIndex createDiskInvIndex(OnDiskInvertedIndexFactory invIndexFactory,
+ FileReference dictBTreeFileRef, boolean create) throws HyracksDataException, IndexException {
IInvertedIndex invIndex = invIndexFactory.createIndexInstance(dictBTreeFileRef);
if (create) {
invIndex.create();
@@ -204,8 +204,9 @@
invIndex.activate();
return invIndex;
}
-
- protected ITreeIndex createDiskTree(BTreeFactory btreeFactory, FileReference btreeFileRef, boolean create) throws HyracksDataException, IndexException {
+
+ protected ITreeIndex createDiskTree(BTreeFactory btreeFactory, FileReference btreeFileRef, boolean create)
+ throws HyracksDataException, IndexException {
ITreeIndex btree = btreeFactory.createIndexInstance(btreeFileRef);
if (create) {
btree.create();
@@ -214,7 +215,7 @@
btree.activate();
return btree;
}
-
+
@Override
public void clear() throws HyracksDataException {
if (!isActivated) {
@@ -268,7 +269,7 @@
}
memComponent.getInvIndex().destroy();
- memComponent.getDeletedKeysBTree().destroy();
+ memComponent.getDeletedKeysBTree().destroy();
for (Object o : diskComponents) {
LSMInvertedIndexComponent component = (LSMInvertedIndexComponent) o;
component.getInvIndex().destroy();
@@ -305,7 +306,7 @@
public IIndexBulkLoader createBulkLoader(float fillFactor, boolean verifyInput) throws IndexException {
return new LSMInvertedIndexBulkLoader(fillFactor, verifyInput);
}
-
+
/**
* The keys in the in-memory deleted-keys BTree only refer to on-disk components.
* We delete documents from the in-memory inverted index by deleting its entries directly,
@@ -321,12 +322,12 @@
* - Insert key into deleted-keys BTree.
*/
@Override
- public boolean insertUpdateOrDelete(ITupleReference tuple, IIndexOperationContext ictx) throws HyracksDataException,
- IndexException {
+ public boolean insertUpdateOrDelete(ITupleReference tuple, IIndexOperationContext ictx)
+ throws HyracksDataException, IndexException {
LSMInvertedIndexOpContext ctx = (LSMInvertedIndexOpContext) ictx;
ctx.modificationCallback.before(tuple);
switch (ctx.getIndexOp()) {
- case INSERT: {
+ case INSERT: {
// Insert into the in-memory inverted index.
ctx.memInvIndexAccessor.insert(tuple);
break;
@@ -352,8 +353,9 @@
}
@Override
- public void search(IIndexCursor cursor, List<Object> diskComponents, ISearchPredicate pred, IIndexOperationContext ictx,
- boolean includeMemComponent, AtomicInteger searcherRefCount) throws HyracksDataException, IndexException {
+ public void search(IIndexCursor cursor, List<Object> diskComponents, ISearchPredicate pred,
+ IIndexOperationContext ictx, boolean includeMemComponent, AtomicInteger searcherRefCount)
+ throws HyracksDataException, IndexException {
int numComponents = (includeMemComponent) ? diskComponents.size() : diskComponents.size() + 1;
ArrayList<IIndexAccessor> indexAccessors = new ArrayList<IIndexAccessor>(numComponents);
ArrayList<IIndexAccessor> deletedKeysBTreeAccessors = new ArrayList<IIndexAccessor>(numComponents);
@@ -398,7 +400,7 @@
}
return initState;
}
-
+
/**
* Returns a permuting tuple reference that projects away the document field(s) of a tuple, only leaving the key fields.
*/
@@ -411,7 +413,7 @@
}
return new PermutingTupleReference(keyFieldPermutation);
}
-
+
@Override
public Object merge(List<Object> mergedComponents, ILSMIOOperation operation) throws HyracksDataException,
IndexException {
@@ -439,15 +441,15 @@
// Add the merged components for cleanup.
mergedComponents.addAll(mergeOp.getMergingComponents());
-
+
return new LSMInvertedIndexComponent(mergedDiskInvertedIndex, deletedKeysBTree);
}
-
+
@Override
public ILSMIOOperation createMergeOperation(ILSMIOOperationCallback callback) throws HyracksDataException,
IndexException {
LSMInvertedIndexOpContext ctx = createOpContext(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
- ctx.startOperation(IndexOperation.SEARCH);
+ ctx.setOperation(IndexOperation.SEARCH);
IIndexCursor cursor = new LSMInvertedIndexRangeSearchCursor();
RangePredicate mergePred = new RangePredicate(null, null, true, true, null, null);
@@ -478,7 +480,7 @@
return mergeOp;
}
-
+
@Override
public void addMergedComponent(Object newComponent, List<Object> mergedComponents) {
diskComponents.removeAll(mergedComponents);
@@ -531,8 +533,8 @@
flushOp.getDeletedKeysBTreeFlushTarget(), true);
// Create a scan cursor on the deleted keys BTree underlying the in-memory inverted index.
- IIndexAccessor deletedKeysBTreeAccessor = memComponent.getDeletedKeysBTree()
- .createAccessor(NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
+ IIndexAccessor deletedKeysBTreeAccessor = memComponent.getDeletedKeysBTree().createAccessor(
+ NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
IIndexCursor deletedKeysScanCursor = deletedKeysBTreeAccessor.createSearchCursor();
deletedKeysBTreeAccessor.search(deletedKeysScanCursor, nullPred);
@@ -609,7 +611,7 @@
lsmHarness.addBulkLoadedComponent(diskComponent);
}
}
-
+
@Override
public void resetInMemoryComponent() throws HyracksDataException {
memFreePageManager.reset();
@@ -618,16 +620,16 @@
}
@Override
- public long getInMemorySize() {
+ public long getMemoryAllocationSize() {
InMemoryBufferCache memBufferCache = (InMemoryBufferCache) memComponent.getInvIndex().getBufferCache();
return memBufferCache.getNumPages() * memBufferCache.getPageSize();
}
-
+
@Override
public InMemoryFreePageManager getInMemoryFreePageManager() {
return memFreePageManager;
}
-
+
@Override
public List<Object> getDiskComponents() {
return diskComponents;
@@ -637,7 +639,7 @@
public ILSMComponentFinalizer getComponentFinalizer() {
return componentFinalizer;
}
-
+
@Override
public ILSMFlushController getFlushController() {
return lsmHarness.getFlushController();
@@ -659,18 +661,13 @@
}
@Override
- public IndexType getIndexType() {
- return IndexType.INVERTED;
- }
-
- @Override
public IInvertedListCursor createInvertedListCursor() {
throw new UnsupportedOperationException("Cannot create inverted list cursor on lsm inverted index.");
}
@Override
- public void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey, IIndexOperationContext ictx)
- throws HyracksDataException, IndexException {
+ public void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey,
+ IIndexOperationContext ictx) throws HyracksDataException, IndexException {
throw new UnsupportedOperationException("Cannot open inverted list cursor on lsm inverted index.");
}
@@ -693,7 +690,7 @@
public IBinaryComparatorFactory[] getTokenCmpFactories() {
return tokenCmpFactories;
}
-
+
public IBinaryTokenizerFactory getTokenizerFactory() {
return tokenizerFactory;
}
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java
index 071bab4..64db7b1 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexAccessor.java
@@ -49,18 +49,18 @@
@Override
public void insert(ITupleReference tuple) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.INSERT);
+ ctx.setOperation(IndexOperation.INSERT);
lsmHarness.insertUpdateOrDelete(tuple, ctx);
}
@Override
public void delete(ITupleReference tuple) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.DELETE);
+ ctx.setOperation(IndexOperation.DELETE);
lsmHarness.insertUpdateOrDelete(tuple, ctx);
}
public void search(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException, IndexException {
- ctx.startOperation(IndexOperation.SEARCH);
+ ctx.setOperation(IndexOperation.SEARCH);
lsmHarness.search(cursor, searchPred, ctx, true);
}
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
index 1792342..dacc974 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/impls/LSMInvertedIndexOpContext.java
@@ -57,7 +57,7 @@
@Override
// TODO: Ignore opcallback for now.
- public void startOperation(IndexOperation newOp) {
+ public void setOperation(IndexOperation newOp) {
switch (newOp) {
case INSERT:
case DELETE:
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java
index 8997959..f0af06a 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndex.java
@@ -35,7 +35,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
import edu.uci.ics.hyracks.storage.am.lsm.common.freepage.InMemoryBufferCache;
import edu.uci.ics.hyracks.storage.am.lsm.invertedindex.api.IInvertedIndex;
@@ -128,7 +127,7 @@
}
}
}
-
+
public void delete(ITupleReference tuple, BTreeAccessor btreeAccessor, IIndexOperationContext ictx)
throws HyracksDataException, IndexException {
InMemoryInvertedIndexOpContext ctx = (InMemoryInvertedIndexOpContext) ictx;
@@ -145,7 +144,7 @@
}
@Override
- public long getInMemorySize() {
+ public long getMemoryAllocationSize() {
InMemoryBufferCache memBufferCache = (InMemoryBufferCache) btree.getBufferCache();
return memBufferCache.getNumPages() * memBufferCache.getPageSize();
}
@@ -159,7 +158,7 @@
public void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey,
IIndexOperationContext ictx) throws HyracksDataException, IndexException {
InMemoryInvertedIndexOpContext ctx = (InMemoryInvertedIndexOpContext) ictx;
- ctx.startOperation(IndexOperation.SEARCH);
+ ctx.setOperation(IndexOperation.SEARCH);
InMemoryInvertedListCursor inMemListCursor = (InMemoryInvertedListCursor) listCursor;
inMemListCursor.prepare(ctx.btreeAccessor, ctx.btreePred, ctx.tokenFieldsCmp, ctx.btreeCmp);
inMemListCursor.reset(searchKey);
@@ -177,11 +176,6 @@
return btree.getBufferCache();
}
- @Override
- public IndexType getIndexType() {
- return IndexType.INVERTED;
- }
-
public BTree getBTree() {
return btree;
}
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java
index 919487d..5a352c3 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexAccessor.java
@@ -53,13 +53,13 @@
@Override
public void insert(ITupleReference tuple) throws HyracksDataException, IndexException {
- opCtx.startOperation(IndexOperation.INSERT);
+ opCtx.setOperation(IndexOperation.INSERT);
index.insert(tuple, btreeAccessor, opCtx);
}
@Override
public void delete(ITupleReference tuple) throws HyracksDataException, IndexException {
- opCtx.startOperation(IndexOperation.DELETE);
+ opCtx.setOperation(IndexOperation.DELETE);
index.delete(tuple, btreeAccessor, opCtx);
}
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java
index 8ad6ccd..82c095f 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/inmemory/InMemoryInvertedIndexOpContext.java
@@ -50,7 +50,7 @@
}
@Override
- public void startOperation(IndexOperation newOp) {
+ public void setOperation(IndexOperation newOp) {
switch (newOp) {
case INSERT:
case DELETE: {
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java
index 9cd02d8..26e6b6a 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndex.java
@@ -41,7 +41,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.api.UnsortedInputException;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallback;
@@ -105,7 +104,7 @@
private final FileReference invListsFile;
// Last page id of inverted-lists file (inclusive). Set during bulk load.
private int invListsMaxPageId = -1;
-
+
private boolean isOpen = false;
public OnDiskInvertedIndex(IBufferCache bufferCache, IFileMapProvider fileMapProvider,
@@ -246,10 +245,10 @@
public IInvertedListCursor createInvertedListCursor() {
return new FixedSizeElementInvertedListCursor(bufferCache, fileId, invListTypeTraits);
}
-
+
@Override
- public void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey, IIndexOperationContext ictx)
- throws HyracksDataException, IndexException {
+ public void openInvertedListCursor(IInvertedListCursor listCursor, ITupleReference searchKey,
+ IIndexOperationContext ictx) throws HyracksDataException, IndexException {
OnDiskInvertedIndexOpContext ctx = (OnDiskInvertedIndexOpContext) ictx;
ctx.btreePred.setLowKeyComparator(ctx.searchCmp);
ctx.btreePred.setHighKeyComparator(ctx.searchCmp);
@@ -295,15 +294,15 @@
private ICachedPage currentPage;
private final MultiComparator tokenCmp;
private final MultiComparator invListCmp;
-
+
private final boolean verifyInput;
private final MultiComparator allCmp;
-
+
public OnDiskInvertedIndexBulkLoader(float btreeFillFactor, boolean verifyInput, int startPageId, int fileId)
throws IndexException, HyracksDataException {
this.verifyInput = verifyInput;
this.tokenCmp = MultiComparator.create(btree.getComparatorFactories());
- this.invListCmp = MultiComparator.create(invListCmpFactories);
+ this.invListCmp = MultiComparator.create(invListCmpFactories);
if (verifyInput) {
allCmp = MultiComparator.create(btree.getComparatorFactories(), invListCmpFactories);
} else {
@@ -397,7 +396,7 @@
"Input stream given to OnDiskInvertedIndex bulk load is not sorted.");
}
}
-
+
// Remember last tuple by creating a copy.
// TODO: This portion can be optimized by only copying the token when it changes, and using the last appended inverted-list element as a reference.
lastTupleBuilder.reset();
@@ -434,7 +433,7 @@
public int getInvListsMaxPageId() {
return invListsMaxPageId;
}
-
+
public IBinaryComparatorFactory[] getInvListCmpFactories() {
return invListCmpFactories;
}
@@ -483,13 +482,14 @@
public IIndexCursor createRangeSearchCursor() {
return new OnDiskInvertedIndexRangeSearchCursor(index, opCtx);
}
-
+
@Override
- public void rangeSearch(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException, IndexException {
+ public void rangeSearch(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException,
+ IndexException {
OnDiskInvertedIndexRangeSearchCursor rangeSearchCursor = (OnDiskInvertedIndexRangeSearchCursor) cursor;
rangeSearchCursor.open(null, searchPred);
}
-
+
@Override
public void insert(ITupleReference tuple) throws HyracksDataException, IndexException {
throw new UnsupportedOperationException("Insert not supported by inverted index.");
@@ -517,11 +517,6 @@
return new OnDiskInvertedIndexAccessor(this);
}
- @Override
- public IndexType getIndexType() {
- return IndexType.INVERTED;
- }
-
// This is just a dummy hyracks context for allocating frames for temporary
// results during inverted index searches.
// TODO: In the future we should use the real HyracksTaskContext to track
@@ -573,7 +568,7 @@
NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
IInvertedListCursor invListCursor = invIndexAccessor.createInvertedListCursor();
MultiComparator invListCmp = MultiComparator.create(invListCmpFactories);
-
+
try {
// Search key for finding an inverted-list in the actual index.
ArrayTupleBuilder prevBuilder = new ArrayTupleBuilder(invListTypeTraits.length);
@@ -616,7 +611,7 @@
}
@Override
- public long getInMemorySize() {
+ public long getMemoryAllocationSize() {
return 0;
}
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java
index 647a2b5..1b4ff94c 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/ondisk/OnDiskInvertedIndexOpContext.java
@@ -44,7 +44,7 @@
}
@Override
- public void startOperation(IndexOperation newOp) {
+ public void setOperation(IndexOperation newOp) {
// Nothing to be done here, only search operation supported.
}
}
diff --git a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
index b57947b..d0dd05a 100644
--- a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
+++ b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/AbstractLSMRTree.java
@@ -34,7 +34,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
import edu.uci.ics.hyracks.storage.am.common.impls.NoOpOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOperation;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMComponentFinalizer;
@@ -261,18 +260,13 @@
}
@Override
- public IndexType getIndexType() {
- return memComponent.getRTree().getIndexType();
- }
-
- @Override
public int getFileId() {
return memComponent.getRTree().getFileId();
}
@Override
- public boolean insertUpdateOrDelete(ITupleReference tuple, IIndexOperationContext ictx) throws HyracksDataException,
- IndexException {
+ public boolean insertUpdateOrDelete(ITupleReference tuple, IIndexOperationContext ictx)
+ throws HyracksDataException, IndexException {
LSMRTreeOpContext ctx = (LSMRTreeOpContext) ictx;
if (ctx.getIndexOp() == IndexOperation.PHYSICALDELETE) {
throw new UnsupportedOperationException("Physical delete not yet supported in LSM R-tree");
@@ -406,7 +400,7 @@
}
@Override
- public long getInMemorySize() {
+ public long getMemoryAllocationSize() {
InMemoryBufferCache memBufferCache = (InMemoryBufferCache) memComponent.rtree.getBufferCache();
return memBufferCache.getNumPages() * memBufferCache.getPageSize();
}
diff --git a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
index 55a4da4..5bfe741 100644
--- a/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
+++ b/hyracks-storage-am-lsm-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/rtree/impls/LSMRTreeOpContext.java
@@ -57,11 +57,11 @@
btreeMetaFrame, btreeCmpFactories, NoOpOperationCallback.INSTANCE, NoOpOperationCallback.INSTANCE);
}
- public void startOperation(IndexOperation newOp) {
+ public void setOperation(IndexOperation newOp) {
if (newOp == IndexOperation.INSERT) {
- rtreeOpContext.startOperation(newOp);
+ rtreeOpContext.setOperation(newOp);
} else if (newOp == IndexOperation.DELETE) {
- btreeOpContext.startOperation(IndexOperation.INSERT);
+ btreeOpContext.setOperation(IndexOperation.INSERT);
}
this.op = newOp;
}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java
index 5e426bc..9eb8ed4 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTree.java
@@ -26,18 +26,17 @@
import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexBulkLoader;
-import edu.uci.ics.hyracks.storage.am.common.api.IIndexCursor;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexOperationContext;
+import edu.uci.ics.hyracks.storage.am.common.api.IIndexCursor;
import edu.uci.ics.hyracks.storage.am.common.api.IModificationOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexAccessor;
-import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrame;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
+import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexCursor;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleReference;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.frames.FrameOpSpaceStatus;
import edu.uci.ics.hyracks.storage.am.common.impls.AbstractTreeIndex;
@@ -145,7 +144,8 @@
.createFrame(), cmpFactories, 8, modificationCallback);
}
- private void insert(ITupleReference tuple, IIndexOperationContext ictx) throws HyracksDataException, TreeIndexException {
+ private void insert(ITupleReference tuple, IIndexOperationContext ictx) throws HyracksDataException,
+ TreeIndexException {
RTreeOpContext ctx = (RTreeOpContext) ictx;
ctx.reset();
ctx.setTuple(tuple);
@@ -778,11 +778,6 @@
}
@Override
- public IndexType getIndexType() {
- return IndexType.RTREE;
- }
-
- @Override
public ITreeIndexAccessor createAccessor(IModificationOperationCallback modificationCallback,
ISearchOperationCallback searchCallback) {
return new RTreeAccessor(this, modificationCallback, searchCallback);
@@ -800,19 +795,19 @@
@Override
public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
- ctx.startOperation(IndexOperation.INSERT);
+ ctx.setOperation(IndexOperation.INSERT);
rtree.insert(tuple, ctx);
}
@Override
public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
- ctx.startOperation(IndexOperation.UPDATE);
+ ctx.setOperation(IndexOperation.UPDATE);
rtree.update(tuple, ctx);
}
@Override
public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
- ctx.startOperation(IndexOperation.DELETE);
+ ctx.setOperation(IndexOperation.DELETE);
rtree.delete(tuple, ctx);
}
@@ -825,7 +820,7 @@
@Override
public void search(IIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException,
IndexException {
- ctx.startOperation(IndexOperation.SEARCH);
+ ctx.setOperation(IndexOperation.SEARCH);
rtree.search((ITreeIndexCursor) cursor, searchPred, ctx);
}
@@ -836,7 +831,7 @@
@Override
public void diskOrderScan(ITreeIndexCursor cursor) throws HyracksDataException {
- ctx.startOperation(IndexOperation.DISKORDERSCAN);
+ ctx.setOperation(IndexOperation.DISKORDERSCAN);
rtree.diskOrderScan(cursor, ctx);
}
diff --git a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java
index fd2292b..a9ada89 100644
--- a/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java
+++ b/hyracks-storage-am-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/rtree/impls/RTreeOpContext.java
@@ -83,7 +83,7 @@
}
@Override
- public void startOperation(IndexOperation newOp) {
+ public void setOperation(IndexOperation newOp) {
if (op != null && newOp == op) {
return;
}