Removed PageAllocationException.
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1035 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java
index 4856595..82148ac 100644
--- a/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java
+++ b/hyracks-storage-am-btree/src/main/java/edu/uci/ics/hyracks/storage/am/btree/frames/BTreeNSMLeafFrame.java
@@ -117,7 +117,7 @@
@Override
public void split(ITreeIndexFrame rightFrame, ITupleReference tuple, ISplitKey splitKey) throws TreeIndexException {
- ByteBuffer right = rightFrame.getBuffer();
+ ByteBuffer right = rightFrame.getBuffer();
int tupleCount = getTupleCount();
// Find split point, and determine into which frame the new tuple should be inserted into.
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 edcc6b2..19ab91f 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
@@ -39,7 +39,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexTupleWriter;
import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
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.TreeDiskOrderScanCursor;
@@ -138,7 +137,7 @@
}
private void search(ITreeIndexCursor cursor, ISearchPredicate searchPred, BTreeOpContext ctx)
- throws TreeIndexException, HyracksDataException, PageAllocationException {
+ throws TreeIndexException, HyracksDataException {
ctx.reset();
ctx.pred = (RangePredicate) searchPred;
ctx.cursor = cursor;
@@ -199,7 +198,7 @@
}
}
- private void createNewRoot(BTreeOpContext ctx) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ private void createNewRoot(BTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
// Make sure the root is always in the same page.
ICachedPage leftNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, ctx.splitKey.getLeftPage()),
false);
@@ -245,7 +244,7 @@
}
}
- private void insertUpdateOrDelete(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ private void insertUpdateOrDelete(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
ctx.reset();
ctx.pred.setLowKeyComparator(cmp);
ctx.pred.setHighKeyComparator(cmp);
@@ -281,11 +280,11 @@
}
}
- private void insert(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ private void insert(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
insertUpdateOrDelete(tuple, ctx);
}
- private void update(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ private void update(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
// This call only allows updating of non-key fields.
// Updating a tuple's key necessitates deleting the old entry, and inserting the new entry.
// The user of the BTree is responsible for dealing with non-key updates (i.e., doing a delete + insert).
@@ -295,7 +294,7 @@
insertUpdateOrDelete(tuple, ctx);
}
- private void delete(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ private void delete(ITupleReference tuple, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
insertUpdateOrDelete(tuple, ctx);
}
@@ -666,7 +665,7 @@
return isConsistent;
}
- private void performOp(int pageId, ICachedPage parent, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ private void performOp(int pageId, ICachedPage parent, BTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
ICachedPage node = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, pageId), false);
ctx.interiorFrame.setPage(node);
@@ -801,13 +800,6 @@
ctx.exceptionHandled = true;
}
throw e;
- } catch (PageAllocationException e) {
- if (!ctx.exceptionHandled) {
- releaseLatch(node, ctx, unsafeIsLeaf);
- bufferCache.unpin(node);
- ctx.exceptionHandled = true;
- }
- throw e;
} catch (Exception e) {
e.printStackTrace();
releaseLatch(node, ctx, unsafeIsLeaf);
@@ -831,7 +823,7 @@
private final ITreeIndexTupleWriter tupleWriter;
public BulkLoadContext(float fillFactor, IBTreeLeafFrame leafFrame, IBTreeInteriorFrame interiorFrame,
- ITreeIndexMetaDataFrame metaFrame, MultiComparator cmp) throws HyracksDataException, PageAllocationException {
+ ITreeIndexMetaDataFrame metaFrame, MultiComparator cmp) throws HyracksDataException {
leafFrame.setMultiComparator(cmp);
interiorFrame.setMultiComparator(cmp);
@@ -862,7 +854,7 @@
nodeFrontiers.add(leafFrontier);
}
- private void addLevel() throws HyracksDataException, PageAllocationException {
+ private void addLevel() throws HyracksDataException {
NodeFrontier frontier = new NodeFrontier(tupleWriter.createTupleReference());
frontier.pageId = freePageManager.getFreePage(metaFrame);
frontier.page = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, frontier.pageId), true);
@@ -874,7 +866,7 @@
}
}
- private void propagateBulk(BulkLoadContext ctx, int level) throws HyracksDataException, PageAllocationException {
+ private void propagateBulk(BulkLoadContext ctx, int level) throws HyracksDataException {
if (ctx.splitKey.getBuffer() == null)
return;
@@ -920,7 +912,7 @@
// assumes btree has been created and opened
@Override
- public IIndexBulkLoadContext beginBulkLoad(float fillFactor) throws TreeIndexException, HyracksDataException, PageAllocationException {
+ public IIndexBulkLoadContext beginBulkLoad(float fillFactor) throws TreeIndexException, HyracksDataException {
IBTreeLeafFrame leafFrame = (IBTreeLeafFrame)leafFrameFactory.createFrame();
if (!isEmptyTree(leafFrame)) {
throw new BTreeException("Trying to Bulk-load a non-empty BTree.");
@@ -933,7 +925,7 @@
}
@Override
- public void bulkLoadAddTuple(ITupleReference tuple, IIndexBulkLoadContext ictx) throws HyracksDataException, PageAllocationException {
+ public void bulkLoadAddTuple(ITupleReference tuple, IIndexBulkLoadContext ictx) throws HyracksDataException {
BulkLoadContext ctx = (BulkLoadContext) ictx;
NodeFrontier leafFrontier = ctx.nodeFrontiers.get(0);
IBTreeLeafFrame leafFrame = ctx.leafFrame;
@@ -1140,26 +1132,26 @@
}
@Override
- public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.reset(IndexOp.INSERT);
btree.insert(tuple, ctx);
}
@Override
- public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.reset(IndexOp.UPDATE);
btree.update(tuple, ctx);
}
@Override
- public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.reset(IndexOp.DELETE);
btree.delete(tuple, ctx);
}
@Override
public void search(ITreeIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException,
- TreeIndexException, PageAllocationException {
+ TreeIndexException {
ctx.reset(IndexOp.SEARCH);
btree.search(cursor, searchPred, ctx);
}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java
index a7901c8..045ff9d 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/IFreePageManager.java
@@ -4,7 +4,7 @@
public interface IFreePageManager {
public int getFreePage(ITreeIndexMetaDataFrame metaFrame)
- throws HyracksDataException, PageAllocationException;
+ throws HyracksDataException;
public void addFreePage(ITreeIndexMetaDataFrame metaFrame, int freePage)
throws HyracksDataException;
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java
index 46d22d1..1c9dca3 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndex.java
@@ -47,12 +47,10 @@
* If the BufferCache throws while un/pinning or un/latching.
* @throws TreeIndexException
* If the tree is not empty.
- * @throws PageAllocationException
* @returns A new context for bulk loading, required for appending tuples.
*/
public IIndexBulkLoadContext beginBulkLoad(float fillFactor)
- throws TreeIndexException, HyracksDataException,
- PageAllocationException;
+ throws TreeIndexException, HyracksDataException;
/**
* Append a tuple to the index in the context of a bulk load.
@@ -63,11 +61,9 @@
* Existing bulk load context.
* @throws HyracksDataException
* If the BufferCache throws while un/pinning or un/latching.
- * @throws PageAllocationException
*/
public void bulkLoadAddTuple(ITupleReference tuple,
- IIndexBulkLoadContext ictx) throws HyracksDataException,
- PageAllocationException;
+ IIndexBulkLoadContext ictx) throws HyracksDataException;
/**
* Finalize the bulk loading operation in the given context.
@@ -76,10 +72,9 @@
* Existing bulk load context to be finalized.
* @throws HyracksDataException
* If the BufferCache throws while un/pinning or un/latching.
- * @throws PageAllocationException
*/
public void endBulkLoad(IIndexBulkLoadContext ictx)
- throws HyracksDataException, PageAllocationException;
+ throws HyracksDataException;
/**
* @return The index's leaf frame factory.
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexAccessor.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexAccessor.java
index 1e679b2..e187aa8 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexAccessor.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/ITreeIndexAccessor.java
@@ -36,10 +36,9 @@
* @throws TreeIndexException
* If an index-specific constraint is violated, e.g., the key
* already exists.
- * @throws PageAllocationException
*/
public void insert(ITupleReference tuple) throws HyracksDataException,
- TreeIndexException, PageAllocationException;
+ TreeIndexException;
/**
* Updates the tuple in the index matching the given tuple with the new
@@ -52,10 +51,9 @@
* If the BufferCache throws while un/pinning or un/latching.
* @throws TreeIndexException
* If there is no matching tuple in the index.
- * @throws PageAllocationException
*/
public void update(ITupleReference tuple) throws HyracksDataException,
- TreeIndexException, PageAllocationException;
+ TreeIndexException;
/**
* Deletes the tuple in the index matching the given tuple.
@@ -66,10 +64,9 @@
* If the BufferCache throws while un/pinning or un/latching.
* @throws TreeIndexException
* If there is no matching tuple in the index.
- * @throws PageAllocationException
*/
public void delete(ITupleReference tuple) throws HyracksDataException,
- TreeIndexException, PageAllocationException;
+ TreeIndexException;
/**
* Open the given cursor for an index search using the given predicate as
@@ -82,10 +79,9 @@
* @throws HyracksDataException
* If the BufferCache throws while un/pinning or un/latching.
* @throws TreeIndexException
- * @throws PageAllocationException
*/
public void search(ITreeIndexCursor cursor, ISearchPredicate searchPred)
- throws HyracksDataException, TreeIndexException, PageAllocationException;
+ throws HyracksDataException, TreeIndexException;
/**
* Open the given cursor for a disk-order scan, positioning the cursor to
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/PageAllocationException.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/PageAllocationException.java
deleted file mode 100644
index e6eec66..0000000
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/api/PageAllocationException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2009-2010 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.common.api;
-
-public class PageAllocationException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public PageAllocationException(Throwable cause) {
- super(cause);
- }
-
- public PageAllocationException(String message) {
- super(message);
- }
-}
diff --git a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java
index bc2d67e..fe3b10f 100644
--- a/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java
+++ b/hyracks-storage-am-common/src/main/java/edu/uci/ics/hyracks/storage/am/common/dataflow/TreeIndexBulkLoadOperatorNodePushable.java
@@ -24,7 +24,6 @@
import edu.uci.ics.hyracks.dataflow.std.base.AbstractUnaryInputSinkOperatorNodePushable;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexBulkLoadContext;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndex;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
public class TreeIndexBulkLoadOperatorNodePushable extends AbstractUnaryInputSinkOperatorNodePushable {
private float fillFactor;
@@ -70,11 +69,7 @@
int tupleCount = accessor.getTupleCount();
for (int i = 0; i < tupleCount; i++) {
tuple.reset(accessor, i);
- try {
- treeIndex.bulkLoadAddTuple(tuple, bulkLoadCtx);
- } catch (PageAllocationException e) {
- throw new HyracksDataException(e);
- }
+ treeIndex.bulkLoadAddTuple(tuple, bulkLoadCtx);
}
}
@@ -82,7 +77,7 @@
public void close() throws HyracksDataException {
try {
treeIndex.endBulkLoad(bulkLoadCtx);
- } catch (PageAllocationException e) {
+ } catch (Exception e) {
throw new HyracksDataException(e);
} finally {
treeIndexHelper.deinit();
diff --git a/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/InvertedIndexBulkLoadOperatorNodePushable.java b/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/InvertedIndexBulkLoadOperatorNodePushable.java
index 9dcabb4..f6cd4cd 100644
--- a/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/InvertedIndexBulkLoadOperatorNodePushable.java
+++ b/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/dataflow/InvertedIndexBulkLoadOperatorNodePushable.java
@@ -23,7 +23,6 @@
import edu.uci.ics.hyracks.dataflow.common.comm.io.FrameTupleAccessor;
import edu.uci.ics.hyracks.dataflow.std.base.AbstractUnaryInputSinkOperatorNodePushable;
import edu.uci.ics.hyracks.storage.am.btree.impls.BTree;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.dataflow.PermutingFrameTupleReference;
import edu.uci.ics.hyracks.storage.am.common.dataflow.TreeIndexDataflowHelper;
import edu.uci.ics.hyracks.storage.am.invertedindex.api.IInvertedListBuilder;
@@ -97,11 +96,7 @@
int tupleCount = accessor.getTupleCount();
for (int i = 0; i < tupleCount; i++) {
tuple.reset(accessor, i);
- try {
- invIndex.bulkLoadAddTuple(bulkLoadCtx, tuple);
- } catch (PageAllocationException e) {
- throw new HyracksDataException(e);
- }
+ invIndex.bulkLoadAddTuple(bulkLoadCtx, tuple);
}
}
@@ -109,7 +104,7 @@
public void close() throws HyracksDataException {
try {
invIndex.endBulkLoad(bulkLoadCtx);
- } catch (PageAllocationException e) {
+ } catch (Exception e) {
throw new HyracksDataException(e);
} finally {
try {
diff --git a/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/impls/InvertedIndex.java b/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/impls/InvertedIndex.java
index 986e57b..d4b5827 100644
--- a/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/impls/InvertedIndex.java
+++ b/hyracks-storage-am-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/invertedindex/impls/InvertedIndex.java
@@ -33,7 +33,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexBulkLoadContext;
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.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndex;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
@@ -85,7 +84,7 @@
}
public BulkLoadContext beginBulkLoad(IInvertedListBuilder invListBuilder, int hyracksFrameSize,
- float btreeFillFactor) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ float btreeFillFactor) throws HyracksDataException, TreeIndexException {
BulkLoadContext ctx = new BulkLoadContext(invListBuilder, hyracksFrameSize, btreeFillFactor);
ctx.init(rootPageId, fileId);
return ctx;
@@ -97,7 +96,7 @@
// the next invListCmp.getKeyFieldCount() fields in tuple are keys of the
// inverted list (e.g., primary key)
// key fields of inverted list are fixed size
- public void bulkLoadAddTuple(BulkLoadContext ctx, ITupleReference tuple) throws HyracksDataException, PageAllocationException {
+ public void bulkLoadAddTuple(BulkLoadContext ctx, ITupleReference tuple) throws HyracksDataException {
// first inverted list, copy token to baaos and start new list
if (ctx.currentInvListTokenBaaos.size() == 0) {
@@ -190,7 +189,7 @@
return ret;
}
- public void createAndInsertBTreeTuple(BulkLoadContext ctx) throws HyracksDataException, PageAllocationException {
+ public void createAndInsertBTreeTuple(BulkLoadContext ctx) throws HyracksDataException {
// build tuple
ctx.btreeTupleBuilder.reset();
ctx.btreeTupleBuilder.addField(ctx.currentInvListTokenBaaos.getByteArray(), 0,
@@ -211,7 +210,7 @@
btree.bulkLoadAddTuple(ctx.btreeFrameTupleReference, ctx.btreeBulkLoadCtx);
}
- public void endBulkLoad(BulkLoadContext ctx) throws HyracksDataException, PageAllocationException {
+ public void endBulkLoad(BulkLoadContext ctx) throws HyracksDataException {
// create entry in btree for last inverted list
createAndInsertBTreeTuple(ctx);
btree.endBulkLoad(ctx.btreeBulkLoadCtx);
@@ -274,7 +273,7 @@
this.btreeFillFactor = btreeFillFactor;
}
- public void init(int startPageId, int fileId) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ public void init(int startPageId, int fileId) throws HyracksDataException, TreeIndexException {
btreeBulkLoadCtx = btree.beginBulkLoad(BTree.DEFAULT_FILL_FACTOR);
currentPageId = startPageId;
currentPage = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, currentPageId), true);
diff --git a/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/impls/LSMTree.java b/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/impls/LSMTree.java
index 0dde550..a7b9cc5 100644
--- a/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/impls/LSMTree.java
+++ b/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/impls/LSMTree.java
@@ -26,10 +26,10 @@
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.IndexType;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOp;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
+import edu.uci.ics.hyracks.storage.am.lsmtree.common.freepage.FreePageManagerFactory;
import edu.uci.ics.hyracks.storage.am.lsmtree.common.freepage.InMemoryFreePageManager;
import edu.uci.ics.hyracks.storage.am.lsmtree.tuples.LSMTypeAwareTupleReference;
import edu.uci.ics.hyracks.storage.common.buffercache.IBufferCache;
@@ -43,7 +43,7 @@
private int fileId;
private boolean created;
- private final IFreePageManager memFreePageManager;
+ private final InMemoryFreePageManager memFreePageManager;
private final ITreeIndexFrameFactory interiorFrameFactory;
private final ITreeIndexFrameFactory insertLeafFrameFactory;
private final ITreeIndexFrameFactory deleteLeafFrameFactory;
@@ -59,7 +59,7 @@
private boolean flushFlag;
public LSMTree(IBufferCache memCache, IBufferCache bufferCache, int fieldCount, MultiComparator cmp,
- IFreePageManager memFreePageManager, ITreeIndexFrameFactory interiorFrameFactory,
+ InMemoryFreePageManager memFreePageManager, ITreeIndexFrameFactory interiorFrameFactory,
ITreeIndexFrameFactory insertLeafFrameFactory, ITreeIndexFrameFactory deleteLeafFrameFactory,
BTreeFactory bTreeFactory, IFileMapManager fileMapManager) {
this.bufferCache = bufferCache;
@@ -110,16 +110,16 @@
}
private void lsmPerformOp(ITupleReference tuple, LSMTreeOpContext ctx) throws Exception {
- boolean continuePerformOp = false;
- try {
- while (continuePerformOp == false) {
- synchronized (this) {
- if (!flushFlag) {
- threadReferenceCounter++;
- continuePerformOp = true;
- }
+ boolean waitForFlush = false;
+ do {
+ synchronized (this) {
+ if (!flushFlag) {
+ threadReferenceCounter++;
+ waitForFlush = false;
}
}
+ } while (waitForFlush == true);
+ try {
ctx.memBtreeAccessor.insert(tuple);
decreaseThreadReferenceCounter();
} catch (BTreeDuplicateKeyException e) {
@@ -129,7 +129,13 @@
// delete it from the BTree.
ctx.memBtreeAccessor.update(tuple);
decreaseThreadReferenceCounter();
- } catch (PageAllocationException e) {
+ }
+ // Check if we've reached or exceeded the maximum number of pages.
+ // Note: It doesn't matter if this inserter or another concurrent
+ // inserter caused the overflow.
+ // The first inserter reaching this code, should set the flush flag.
+ if (memFreePageManager.isFull()) {
+ // Force concurrent inserters to wait, possibly until a flush has completed.
synchronized (this) {
// If flushFlag is false it means we are the first inserter to
// trigger the flush. If flushFlag is already set to true,
@@ -146,8 +152,6 @@
throw new Error("Thread reference counter is below zero. This indicates a programming error!");
}
}
- lsmPerformOp(tuple, ctx);
- return;
}
}
@@ -220,8 +224,7 @@
}
}
- private void insert(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ private void insert(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
try {
lsmPerformOp(tuple, ctx);
} catch (Exception e) {
@@ -229,8 +232,7 @@
}
}
- private void delete(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ private void delete(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
try {
lsmPerformOp(tuple, ctx);
} catch (Exception e) {
@@ -239,14 +241,12 @@
}
@Override
- public IIndexBulkLoadContext beginBulkLoad(float fillFactor) throws TreeIndexException, HyracksDataException,
- PageAllocationException {
+ public IIndexBulkLoadContext beginBulkLoad(float fillFactor) throws TreeIndexException, HyracksDataException {
return null;
}
@Override
- public void bulkLoadAddTuple(ITupleReference tuple, IIndexBulkLoadContext ictx) throws HyracksDataException,
- PageAllocationException {
+ public void bulkLoadAddTuple(ITupleReference tuple, IIndexBulkLoadContext ictx) throws HyracksDataException {
}
@Override
@@ -546,28 +546,25 @@
}
@Override
- public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.reset(IndexOp.INSERT);
lsmTree.insert(tuple, ctx);
}
@Override
- public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
throw new UnsupportedOperationException("Update not supported by LSMTree");
}
@Override
- public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.reset(IndexOp.DELETE);
lsmTree.delete(tuple, ctx);
}
@Override
public void search(ITreeIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException,
- TreeIndexException, PageAllocationException {
+ TreeIndexException {
ctx.reset(IndexOp.SEARCH);
// TODO: fix exception handling throughout LSM tree.
try {
diff --git a/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/perf/LSMTreeUtils.java b/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/perf/LSMTreeUtils.java
index 7f83b10..08a2aa2 100644
--- a/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/perf/LSMTreeUtils.java
+++ b/hyracks-storage-am-lsmtree-btree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/perf/LSMTreeUtils.java
@@ -6,7 +6,6 @@
import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeLeafFrameType;
import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInteriorFrameFactory;
import edu.uci.ics.hyracks.storage.am.btree.util.BTreeUtils;
-import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.frames.LIFOMetaDataFrameFactory;
@@ -31,7 +30,7 @@
ITreeIndexFrameFactory deleteLeafFrameFactory = BTreeUtils.getLeafFrameFactory(deleteTupleWriterFactory,leafType);
ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(insertTupleWriterFactory);
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(memCache.getNumPages(), metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(memCache.getNumPages(), metaFrameFactory);
// For the Flush Mechanism
LSMEntireTupleWriterFactory flushTupleWriterFactory = new LSMEntireTupleWriterFactory(typeTraits);
diff --git a/hyracks-storage-am-lsmtree-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/freepage/InMemoryFreePageManager.java b/hyracks-storage-am-lsmtree-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/freepage/InMemoryFreePageManager.java
index f2bf010..62dcf55 100644
--- a/hyracks-storage-am-lsmtree-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/freepage/InMemoryFreePageManager.java
+++ b/hyracks-storage-am-lsmtree-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/freepage/InMemoryFreePageManager.java
@@ -1,52 +1,61 @@
+/*
+ * Copyright 2009-2010 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.lsmtree.common.freepage;
+import java.util.concurrent.atomic.AtomicInteger;
+
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
public class InMemoryFreePageManager implements IFreePageManager {
- private final int maxCapacity;
- protected int currentCapacity;
- private final ITreeIndexMetaDataFrameFactory metaDataFrameFactory;
+ protected final int capacity;
+ protected final AtomicInteger currentPageId = new AtomicInteger();
+ protected final ITreeIndexMetaDataFrameFactory metaDataFrameFactory;
public InMemoryFreePageManager(int maxCapacity, ITreeIndexMetaDataFrameFactory metaDataFrameFactory) {
- this.maxCapacity = maxCapacity - 1; // Since the range of CacheArray in
- // InMemoryBufferCache is 0 ~
- // maxCapacity-1
- currentCapacity = 1;
+ // Since the range of CacheArray in InMemoryBufferCache is 0 ~
+ // maxCapacity-1
+ this.capacity = maxCapacity - 1;
+ currentPageId.set(1);
this.metaDataFrameFactory = metaDataFrameFactory;
}
public int getCurrentCapacity() {
- return currentCapacity;
+ return currentPageId.get();
}
@Override
- public synchronized int getFreePage(ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException,
- PageAllocationException {
-
- if (currentCapacity == maxCapacity) {
- throw new PageAllocationException("In-mem tree capacity reaches max capacity");
- }
- currentCapacity++;
- return currentCapacity;
+ public int getFreePage(ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
+ return currentPageId.incrementAndGet();
}
@Override
public void addFreePage(ITreeIndexMetaDataFrame metaFrame, int freePage) throws HyracksDataException {
- System.out.println("InMemoryFreePageManager.addFreePage()");
}
@Override
public int getMaxPage(ITreeIndexMetaDataFrame metaFrame) throws HyracksDataException {
- return currentCapacity;
+ return currentPageId.get();
}
@Override
public void init(ITreeIndexMetaDataFrame metaFrame, int currentMaxPage) throws HyracksDataException {
- currentCapacity = 1;
+ currentPageId.set(1);
}
@Override
@@ -56,29 +65,29 @@
@Override
public byte getMetaPageLevelIndicator() {
- System.out.println("InMemoryFreePageManager.getMetaPageLevelIndicator()");
return 0;
}
@Override
public byte getFreePageLevelIndicator() {
- System.out.println("InMemoryFreePageManager.getFreePageLevelIndicator()");
return 0;
}
@Override
public boolean isMetaPage(ITreeIndexMetaDataFrame metaFrame) {
- System.out.println("InMemoryFreePageManager.isMetaPage()");
return false;
}
@Override
public boolean isFreePage(ITreeIndexMetaDataFrame metaFrame) {
- System.out.println("InMemoryFreePageManager.isFreePage()");
return false;
}
public void reset() {
- currentCapacity = 1;
+ currentPageId.set(1);
+ }
+
+ public boolean isFull() {
+ return currentPageId.get() >= capacity;
}
}
diff --git a/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTree.java b/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTree.java
index 8b1c579..c308473 100644
--- a/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTree.java
+++ b/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTree.java
@@ -18,7 +18,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.IndexType;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.IndexOp;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
@@ -43,7 +42,7 @@
private int btreeFileId;
private boolean created;
- private final IFreePageManager memFreePageManager;
+ private final InMemoryFreePageManager memFreePageManager;
private final ITreeIndexFrameFactory rtreeInteriorFrameFactory;
private final ITreeIndexFrameFactory btreeInteriorFrameFactory;
private final ITreeIndexFrameFactory rtreeLeafFrameFactory;
@@ -63,7 +62,7 @@
private boolean flushFlag;
public LSMRTree(IBufferCache rtreeMemCache, IBufferCache bufferCache, int fieldCount, MultiComparator cmp,
- IFreePageManager memFreePageManager, ITreeIndexFrameFactory rtreeInteriorFrameFactory,
+ InMemoryFreePageManager memFreePageManager, ITreeIndexFrameFactory rtreeInteriorFrameFactory,
ITreeIndexFrameFactory btreeInteriorFrameFactory, ITreeIndexFrameFactory rtreeLeafFrameFactory,
ITreeIndexFrameFactory btreeLeafFrameFactory, RTreeFactory rTreeFactory, BTreeFactory bTreeFactory,
IFileMapManager fileMapManager) {
@@ -109,21 +108,19 @@
}
@Override
- public IIndexBulkLoadContext beginBulkLoad(float fillFactor) throws TreeIndexException, HyracksDataException,
- PageAllocationException {
+ public IIndexBulkLoadContext beginBulkLoad(float fillFactor) throws TreeIndexException, HyracksDataException {
// TODO Auto-generated method stub
return null;
}
@Override
- public void bulkLoadAddTuple(ITupleReference tuple, IIndexBulkLoadContext ictx) throws HyracksDataException,
- PageAllocationException {
+ public void bulkLoadAddTuple(ITupleReference tuple, IIndexBulkLoadContext ictx) throws HyracksDataException {
// TODO Auto-generated method stub
}
@Override
- public void endBulkLoad(IIndexBulkLoadContext ictx) throws HyracksDataException, PageAllocationException {
+ public void endBulkLoad(IIndexBulkLoadContext ictx) throws HyracksDataException {
// TODO Auto-generated method stub
}
@@ -314,23 +311,26 @@
}
}
- private void insert(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ private void insert(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
try {
boolean continuePerformOp = false;
- try {
- while (continuePerformOp == false) {
- synchronized (this) {
- if (!flushFlag) {
- threadReferenceCounter++;
- continuePerformOp = true;
- }
- }
- }
- ctx.LSMRTreeOpContext.memRtreeAccessor.insert(tuple);
- decreaseThreadReferenceCounter();
- } catch (PageAllocationException e) {
- synchronized (this) {
+ while (continuePerformOp == false) {
+ synchronized (this) {
+ if (!flushFlag) {
+ threadReferenceCounter++;
+ continuePerformOp = true;
+ }
+ }
+ }
+ ctx.LSMRTreeOpContext.memRtreeAccessor.insert(tuple);
+ decreaseThreadReferenceCounter();
+ // Check if we've reached or exceeded the maximum number of pages.
+ // Note: It doesn't matter if this inserter or another concurrent
+ // inserter caused the overflow.
+ // The first inserter reaching this code, should set the flush flag.
+ // Also, setting the flush flag multiple times doesn't hurt.
+ if (memFreePageManager.isFull()) {
+ synchronized (this) {
// If flushFlag is false it means we are the first inserter
// to
// trigger the flush. If flushFlag is already set to true,
@@ -347,32 +347,32 @@
throw new Error("Thread reference counter is below zero. This indicates a programming error!");
}
}
- insert(tuple, ctx);
- return;
}
-
} catch (Exception e) {
e.printStackTrace();
}
}
- private void delete(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ private void delete(ITupleReference tuple, LSMTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
try {
- boolean continuePerformOp = false;
- try {
- while (continuePerformOp == false) {
- synchronized (this) {
- if (!flushFlag) {
- threadReferenceCounter++;
- continuePerformOp = true;
- }
- }
- }
- ctx.LSMBTreeOpContext.memBtreeAccessor.insert(tuple);
- decreaseThreadReferenceCounter();
- } catch (PageAllocationException e) {
- synchronized (this) {
+ boolean continuePerformOp = false;
+ while (continuePerformOp == false) {
+ synchronized (this) {
+ if (!flushFlag) {
+ threadReferenceCounter++;
+ continuePerformOp = true;
+ }
+ }
+ }
+ ctx.LSMBTreeOpContext.memBtreeAccessor.insert(tuple);
+ decreaseThreadReferenceCounter();
+ // Check if we've reached or exceeded the maximum number of pages.
+ // Note: It doesn't matter if this inserter or another concurrent
+ // inserter caused the overflow.
+ // The first inserter reaching this code, should set the flush flag.
+ // Also, setting the flush flag multiple times doesn't hurt.
+ if (memFreePageManager.isFull()) {
+ synchronized (this) {
// If flushFlag is false it means we are the first inserter
// to
// trigger the flush. If flushFlag is already set to true,
@@ -389,10 +389,7 @@
throw new Error("Thread reference counter is below zero. This indicates a programming error!");
}
}
- delete(tuple, ctx);
- return;
}
-
} catch (Exception e) {
e.printStackTrace();
}
@@ -474,28 +471,25 @@
}
@Override
- public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.LSMRTreeOpContext.reset(IndexOp.INSERT);
lsmRTree.insert(tuple, ctx);
}
@Override
- public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ public void update(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
throw new UnsupportedOperationException("Update not supported by LSMRTree");
}
@Override
- public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ public void delete(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.LSMBTreeOpContext.reset(IndexOp.INSERT);
lsmRTree.delete(tuple, ctx);
}
@Override
public void search(ITreeIndexCursor cursor, ISearchPredicate searchPred) throws HyracksDataException,
- TreeIndexException, PageAllocationException {
+ TreeIndexException {
ctx.reset(IndexOp.SEARCH);
// TODO: fix exception handling throughout LSM tree.
try {
diff --git a/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTreeInMemoryFreePageManager.java b/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTreeInMemoryFreePageManager.java
index 76598ab..6a08899 100644
--- a/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTreeInMemoryFreePageManager.java
+++ b/hyracks-storage-am-lsmtree-rtree/src/main/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/impls/LSMRTreeInMemoryFreePageManager.java
@@ -9,15 +9,15 @@
public LSMRTreeInMemoryFreePageManager(int maxCapacity, ITreeIndexMetaDataFrameFactory metaDataFrameFactory) {
super(maxCapacity, metaDataFrameFactory);
- currentCapacity = 3;
+ currentPageId.set(3);
}
@Override
public void init(ITreeIndexMetaDataFrame metaFrame, int currentMaxPage) throws HyracksDataException {
- currentCapacity = 3;
+ currentPageId.set(3);
}
public void reset() {
- currentCapacity = 3;
+ currentPageId.set(3);
}
}
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 7f06e16..c3b83e2 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
@@ -34,7 +34,6 @@
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
import edu.uci.ics.hyracks.storage.am.common.api.IndexType;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
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.TreeDiskOrderScanCursor;
@@ -244,8 +243,7 @@
.createFrame(), 8);
}
- private void insert(ITupleReference tuple, IIndexOpContext ictx) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ private void insert(ITupleReference tuple, IIndexOpContext ictx) throws HyracksDataException, TreeIndexException {
RTreeOpContext ctx = (RTreeOpContext) ictx;
ctx.reset();
ctx.setTuple(tuple);
@@ -438,7 +436,7 @@
}
private void insertTuple(ICachedPage node, int pageId, ITupleReference tuple, RTreeOpContext ctx, boolean isLeaf)
- throws HyracksDataException, TreeIndexException, PageAllocationException {
+ throws HyracksDataException, TreeIndexException {
FrameOpSpaceStatus spaceStatus;
if (!isLeaf) {
spaceStatus = ctx.interiorFrame.hasSpaceInsert(tuple);
@@ -564,8 +562,7 @@
}
}
- private void updateParentForInsert(RTreeOpContext ctx) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ private void updateParentForInsert(RTreeOpContext ctx) throws HyracksDataException, TreeIndexException {
boolean writeLatched = false;
int parentId = ctx.pathList.getLastPageId();
ICachedPage parentNode = bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, parentId), false);
@@ -1066,8 +1063,7 @@
}
@Override
- public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException,
- PageAllocationException {
+ public void insert(ITupleReference tuple) throws HyracksDataException, TreeIndexException {
ctx.reset(IndexOp.INSERT);
rtree.insert(tuple, ctx);
}
diff --git a/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/btree/util/BTreeTestUtils.java b/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/btree/util/BTreeTestUtils.java
index b5186b0..794f24c 100644
--- a/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/btree/util/BTreeTestUtils.java
+++ b/hyracks-tests/hyracks-storage-am-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/btree/util/BTreeTestUtils.java
@@ -35,7 +35,6 @@
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.ITreeIndexMetaDataFrame;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.common.impls.TreeDiskOrderScanCursor;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
@@ -46,7 +45,7 @@
private static final Logger LOGGER = Logger.getLogger(BTreeTestUtils.class.getName());
public static BTreeTestContext createBTreeTestContext(IBufferCache bufferCache, int btreeFileId, ISerializerDeserializer[] fieldSerdes, int numKeyFields, BTreeLeafFrameType leafType) throws Exception {
- ITypeTraits[] typeTraits = SerdeUtils.serdesToTypeTraits(fieldSerdes, fieldSerdes.length);
+ ITypeTraits[] typeTraits = SerdeUtils.serdesToTypeTraits(fieldSerdes);
IBinaryComparator[] cmps = SerdeUtils.serdesToComparators(fieldSerdes, numKeyFields);
BTree btree = BTreeUtils.createBTree(bufferCache, btreeFileId, typeTraits, cmps, leafType);
@@ -391,7 +390,7 @@
bulkLoadCheckTuples(testCtx, numTuples);
}
- private static void bulkLoadCheckTuples(BTreeTestContext testCtx, int numTuples) throws HyracksDataException, TreeIndexException, PageAllocationException {
+ private static void bulkLoadCheckTuples(BTreeTestContext testCtx, int numTuples) throws HyracksDataException, TreeIndexException {
int fieldCount = testCtx.getFieldCount();
ArrayTupleBuilder tupleBuilder = new ArrayTupleBuilder(fieldCount);
ArrayTupleReference tuple = new ArrayTupleReference();
diff --git a/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchPerfTest.java b/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchPerfTest.java
index 1299fcb..38b8bfa 100644
--- a/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchPerfTest.java
+++ b/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchPerfTest.java
@@ -28,7 +28,6 @@
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
import edu.uci.ics.hyracks.storage.am.btree.impls.BTree;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.invertedindex.api.IInvertedIndexSearchModifier;
import edu.uci.ics.hyracks.storage.am.invertedindex.api.IInvertedListBuilder;
@@ -68,7 +67,7 @@
loadData();
}
- public void loadData() throws HyracksDataException, TreeIndexException, PageAllocationException {
+ public void loadData() throws HyracksDataException, TreeIndexException {
tokens.add("compilers");
tokens.add("computer");
tokens.add("databases");
diff --git a/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchTest.java b/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchTest.java
index eb2b39c..fc99244 100644
--- a/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchTest.java
+++ b/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/SearchTest.java
@@ -30,7 +30,6 @@
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
import edu.uci.ics.hyracks.storage.am.btree.impls.BTree;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.api.TreeIndexException;
import edu.uci.ics.hyracks.storage.am.invertedindex.api.IInvertedIndexSearchModifier;
import edu.uci.ics.hyracks.storage.am.invertedindex.api.IInvertedListBuilder;
@@ -130,7 +129,7 @@
}
}
- public void loadData() throws IOException, TreeIndexException, PageAllocationException {
+ public void loadData() throws IOException, TreeIndexException {
List<TokenIdPair> pairs = new ArrayList<TokenIdPair>();
// generate pairs for subsequent sorting and bulk-loading
int id = 0;
diff --git a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeDeleteTest.java b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeDeleteTest.java
index 42134aa..c7f208b 100644
--- a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeDeleteTest.java
+++ b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeDeleteTest.java
@@ -30,7 +30,6 @@
import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInteriorFrameFactory;
import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMLeafFrameFactory;
import edu.uci.ics.hyracks.storage.am.btree.impls.RangePredicate;
-import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
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.ITreeIndexFrameFactory;
@@ -97,7 +96,7 @@
ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(insertTupleWriterFactory);
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
FreePageManagerFactory freePageManagerFactory = new FreePageManagerFactory(bufferCache, metaFrameFactory);
BTreeFactory bTreeFactory = new BTreeFactory(bufferCache, freePageManagerFactory, cmp, fieldCount,
@@ -245,7 +244,7 @@
ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(insertTupleWriterFactory);
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
FreePageManagerFactory freePageManagerFactory = new FreePageManagerFactory(bufferCache, metaFrameFactory);
BTreeFactory bTreeFactory = new BTreeFactory(bufferCache, freePageManagerFactory, cmp, fieldCount,
@@ -428,7 +427,7 @@
ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(insertTupleWriterFactory);
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
FreePageManagerFactory freePageManagerFactory = new FreePageManagerFactory(bufferCache, metaFrameFactory);
BTreeFactory bTreeFactory = new BTreeFactory(bufferCache, freePageManagerFactory, cmp, fieldCount,
@@ -607,7 +606,7 @@
ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(insertTupleWriterFactory);
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
FreePageManagerFactory freePageManagerFactory = new FreePageManagerFactory(bufferCache, metaFrameFactory);
BTreeFactory bTreeFactory = new BTreeFactory(bufferCache, freePageManagerFactory, cmp, fieldCount,
@@ -716,7 +715,7 @@
ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(insertTupleWriterFactory);
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
FreePageManagerFactory freePageManagerFactory = new FreePageManagerFactory(bufferCache, metaFrameFactory);
BTreeFactory bTreeFactory = new BTreeFactory(bufferCache, freePageManagerFactory, cmp, fieldCount,
@@ -899,7 +898,7 @@
ITreeIndexFrameFactory interiorFrameFactory = new BTreeNSMInteriorFrameFactory(insertTupleWriterFactory);
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
FreePageManagerFactory freePageManagerFactory = new FreePageManagerFactory(bufferCache, metaFrameFactory);
BTreeFactory bTreeFactory = new BTreeFactory(bufferCache, freePageManagerFactory, cmp, fieldCount,
diff --git a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeFlushTest.java b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeFlushTest.java
index f31feb6..07a128c 100644
--- a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeFlushTest.java
+++ b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeFlushTest.java
@@ -365,7 +365,7 @@
IBTreeLeafFrame insertLeafFrame = (IBTreeLeafFrame) insertLeafFrameFactory.createFrame();
IFreePageManager freePageManager = new LinkedListFreePageManager(bufferCache, fileId, 0, metaFrameFactory);
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(NUM_PAGES, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(NUM_PAGES, metaFrameFactory);
// For the Flush Mechanism
LSMEntireTupleWriterFactory flushTupleWriterFactory = new LSMEntireTupleWriterFactory(typeTraits);
diff --git a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeMergeTest.java b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeMergeTest.java
index 00405b5..60583ef 100644
--- a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeMergeTest.java
+++ b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeMergeTest.java
@@ -91,7 +91,7 @@
IBTreeLeafFrame insertLeafFrame = (IBTreeLeafFrame) insertLeafFrameFactory.createFrame();
IFreePageManager freePageManager = new LinkedListFreePageManager(bufferCache, fileId, 0, metaFrameFactory);
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(NUM_PAGES, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(NUM_PAGES, metaFrameFactory);
// For the Flush Mechanism
LSMEntireTupleWriterFactory flushTupleWriterFactory = new LSMEntireTupleWriterFactory(typeTraits);
diff --git a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeSearchTest.java b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeSearchTest.java
index aa8c1cd..5a7cd36 100644
--- a/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeSearchTest.java
+++ b/hyracks-tests/hyracks-storage-am-lsmtree-btree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/btree/LSMTreeSearchTest.java
@@ -105,7 +105,7 @@
IBTreeLeafFrame insertLeafFrame = (IBTreeLeafFrame) insertLeafFrameFactory.createFrame();
IFreePageManager freePageManager = new LinkedListFreePageManager(bufferCache, fileId, 0, metaFrameFactory);
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new InMemoryFreePageManager(100, metaFrameFactory);
LSMEntireTupleWriterFactory flushTupleWriterFactory = new LSMEntireTupleWriterFactory(typeTraits);
ITreeIndexFrameFactory flushLeafFrameFactory = new BTreeNSMLeafFrameFactory(flushTupleWriterFactory);
diff --git a/hyracks-tests/hyracks-storage-am-lsmtree-common-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/InMemoryFreePageManagerTest.java b/hyracks-tests/hyracks-storage-am-lsmtree-common-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/InMemoryFreePageManagerTest.java
index d240918..3978aa6 100644
--- a/hyracks-tests/hyracks-storage-am-lsmtree-common-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/InMemoryFreePageManagerTest.java
+++ b/hyracks-tests/hyracks-storage-am-lsmtree-common-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/common/InMemoryFreePageManagerTest.java
@@ -15,57 +15,21 @@
package edu.uci.ics.hyracks.storage.am.lsmtree.common;
-import static org.junit.Assert.fail;
-
import org.junit.Test;
import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexMetaDataFrameFactory;
-import edu.uci.ics.hyracks.storage.am.common.api.PageAllocationException;
import edu.uci.ics.hyracks.storage.am.common.frames.LIFOMetaDataFrameFactory;
import edu.uci.ics.hyracks.storage.am.lsmtree.common.freepage.InMemoryFreePageManager;
-public class InMemoryFreePageManagerTest{
+public class InMemoryFreePageManagerTest {
@Test
public void InMemoryFreePageManagerTest01() throws Exception {
-
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
IFreePageManager memFreePageManager = new InMemoryFreePageManager(10, metaFrameFactory);
-
- try{
- for(int i = 0; i < 5; i++) {
- memFreePageManager.getFreePage(null);
- }
+ for (int i = 0; i < 5; i++) {
+ memFreePageManager.getFreePage(null);
}
- catch (PageAllocationException e){
- System.out.println("Catch exception: " + e);
- return;
- }
- catch (Exception e) {
- fail("Unexpected exception!");
- }
- }
-
- //Get free pages more than the max capacity
- //expect PageAllocationException
- @Test
- public void InMemoryFreePageManagerTest02() throws Exception {
-
- ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new InMemoryFreePageManager(10, metaFrameFactory);
-
- try{
- for(int i = 0; i < 20; i++) {
- memFreePageManager.getFreePage(null);
- }
- }
- catch (PageAllocationException e){
- System.out.println("Catch exception: " + e);
- return;
- }
- catch (Exception e) {
- fail("Unexpected exception!");
- }
- }
+ }
}
diff --git a/hyracks-tests/hyracks-storage-am-lsmtree-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/LSMRTreeTest.java b/hyracks-tests/hyracks-storage-am-lsmtree-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/LSMRTreeTest.java
index 766b72a..668759d 100644
--- a/hyracks-tests/hyracks-storage-am-lsmtree-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/LSMRTreeTest.java
+++ b/hyracks-tests/hyracks-storage-am-lsmtree-rtree-test/src/test/java/edu/uci/ics/hyracks/storage/am/lsmtree/rtree/LSMRTreeTest.java
@@ -26,7 +26,6 @@
import edu.uci.ics.hyracks.dataflow.common.data.marshalling.IntegerSerializerDeserializer;
import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMInteriorFrameFactory;
import edu.uci.ics.hyracks.storage.am.btree.frames.BTreeNSMLeafFrameFactory;
-import edu.uci.ics.hyracks.storage.am.common.api.IFreePageManager;
import edu.uci.ics.hyracks.storage.am.common.api.IPrimitiveValueProviderFactory;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexAccessor;
import edu.uci.ics.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
@@ -35,6 +34,7 @@
import edu.uci.ics.hyracks.storage.am.common.frames.LIFOMetaDataFrameFactory;
import edu.uci.ics.hyracks.storage.am.common.ophelpers.MultiComparator;
import edu.uci.ics.hyracks.storage.am.lsmtree.common.freepage.FreePageManagerFactory;
+import edu.uci.ics.hyracks.storage.am.lsmtree.common.freepage.InMemoryFreePageManager;
import edu.uci.ics.hyracks.storage.am.lsmtree.rtree.impls.BTreeFactory;
import edu.uci.ics.hyracks.storage.am.lsmtree.rtree.impls.LSMRTree;
import edu.uci.ics.hyracks.storage.am.lsmtree.rtree.impls.LSMRTreeInMemoryBufferCacheFactory;
@@ -113,7 +113,7 @@
ITreeIndexMetaDataFrameFactory metaFrameFactory = new LIFOMetaDataFrameFactory();
- IFreePageManager memFreePageManager = new LSMRTreeInMemoryFreePageManager(100, metaFrameFactory);
+ InMemoryFreePageManager memFreePageManager = new LSMRTreeInMemoryFreePageManager(100, metaFrameFactory);
FreePageManagerFactory freePageManagerFactory = new FreePageManagerFactory(bufferCache, metaFrameFactory);