@Override public void unloadPages() throws HyracksDataException { if (cursorNeedsClose) { btreeCursor.close(); cursorNeedsClose = false; } }
@Override public void doClose() throws HyracksDataException { btreeCursor.close(); }
@Override public void doClose() throws HyracksDataException { try { super.doClose(); } finally { if (deletedKeysBTreeCursors != null) { for (int i = 0; i < deletedKeysBTreeCursors.length; i++) { deletedKeysBTreeCursors[i].close(); } } } }
@Override public void doClose() throws HyracksDataException { try { invListRangeSearchCursor.close(); isInvListCursorOpen = false; } finally { btreeCursor.close(); } }
@Override public void doClose() throws HyracksDataException { try { if (currentCursor != null) { currentCursor.close(); currentCursor = null; } accessorIndex = 0; } finally { if (harness != null) { harness.endSearch(opCtx); } } }
public void reset(ITupleReference tuple) throws HyracksDataException { numElements = -1; // Copy the tokens tuple for later use in btree probes. TupleUtils.copyTuple(tokenTupleBuilder, tuple, tuple.getFieldCount()); tokenTuple.reset(tokenTupleBuilder.getFieldEndOffsets(), tokenTupleBuilder.getByteArray()); btreeSearchTuple.reset(); btreeSearchTuple.addTuple(tokenTuple); btreeCursor.close(); countingCursor.close(); }
protected void pushIntoQueueFromCursorAndReplaceThisElement(PriorityQueueElement e) throws HyracksDataException { int cursorIndex = e.getCursorIndex(); if (rangeCursors[cursorIndex].hasNext()) { rangeCursors[cursorIndex].next(); e.reset(rangeCursors[cursorIndex].getTuple()); outputPriorityQueue.offer(e); return; } rangeCursors[cursorIndex].close(); if (cursorIndex == 0) { includeMutableComponent = false; } }
@Override public void nextFrame(ByteBuffer buffer) throws HyracksDataException { accessor.reset(buffer); int tupleCount = accessor.getTupleCount(); try { for (int i = 0; i < tupleCount && !finished; i++) { resetSearchPredicate(i); cursor.close(); indexAccessor.search(cursor, searchPred); writeSearchResults(i); } } catch (Exception e) { throw HyracksDataException.create(e); } }
@Test public void testDoubleCloseSucceeds() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); cursor.close(); cursor.destroy(); destroy(accessor); }
@Test public void testCloseAfterDestroyFails() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); cursor.destroy(); boolean expectedExceptionThrown = false; try { cursor.close(); } catch (Exception e) { expectedExceptionThrown = true; } destroy(accessor); Assert.assertTrue(expectedExceptionThrown); }
@Test public void testCloseWithoutOpenSucceeds() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); cursor.close(); cursor.destroy(); destroy(accessor); }
@Test public void testDoubleDestroySucceeds() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); cursor.destroy(); cursor.destroy(); destroy(accessor); }
@Test public void testOpenAfterDestroyFails() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); cursor.destroy(); boolean expectedExceptionThrown = false; try { open(accessor, cursor, predicates.get(0)); } catch (Exception e) { expectedExceptionThrown = true; } destroy(accessor); Assert.assertTrue(expectedExceptionThrown); }
@Test public void testGetTupleReturnsNullAfterDestroy() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); cursor.destroy(); destroy(accessor); Assert.assertNull(cursor.getTuple()); }
@Test public void testHasNextAfterCloseFails() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); boolean expectedExceptionThrown = false; try { cursor.hasNext(); } catch (Exception e) { expectedExceptionThrown = true; } cursor.destroy(); destroy(accessor); Assert.assertTrue(expectedExceptionThrown); }
@Test public void testNextAfterCloseFails() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); boolean expectedExceptionThrown = false; try { cursor.next(); } catch (Exception e) { expectedExceptionThrown = true; } cursor.destroy(); destroy(accessor); Assert.assertTrue(expectedExceptionThrown); }
@Test public void testHasNextAfterDestroyFails() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); cursor.destroy(); boolean expectedExceptionThrown = false; try { cursor.hasNext(); } catch (Exception e) { expectedExceptionThrown = true; } destroy(accessor); Assert.assertTrue(expectedExceptionThrown); }
@Test public void testDestroyWhileOpenFails() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); boolean expectedExceptionThrown = false; try { cursor.destroy(); } catch (Exception e) { expectedExceptionThrown = true; } cursor.close(); cursor.destroy(); destroy(accessor); Assert.assertTrue(expectedExceptionThrown); }
@Test public void testNextAfterDestroyFails() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); open(accessor, cursor, predicates.get(0)); cursor.close(); cursor.destroy(); boolean expectedExceptionThrown = false; try { cursor.next(); } catch (Exception e) { expectedExceptionThrown = true; } destroy(accessor); Assert.assertTrue(expectedExceptionThrown); }
@Test public void testNormalLifeCycle() throws Exception { IIndexAccessor accessor = createAccessor(); IIndexCursor cursor = createCursor(accessor); List<ISearchPredicate> predicates = createSearchPredicates(); for (ISearchPredicate predicate : predicates) { open(accessor, cursor, predicate); while (cursor.hasNext()) { cursor.next(); } cursor.close(); } cursor.destroy(); destroy(accessor); }