Examples of CursorImpl


Examples of com.sleepycat.je.dbi.CursorImpl

        OperationStatus status;

        while (true) {
            assert Latch.countLatchesHeld() == 0;
            CursorImpl dup = beginRead(true);

      try {
    if (getMode == GetMode.NEXT) {
        status = dup.getNext
                        (key, data, lockType, true, false);
    } else if (getMode == GetMode.PREV) {
        status = dup.getNext
                        (key, data, lockType, false, false);
    } else if (getMode == GetMode.NEXT_DUP) {
        status = dup.getNextDuplicate
                        (key, data, lockType, true, false);
    } else if (getMode == GetMode.PREV_DUP) {
        status = dup.getNextDuplicate
                        (key, data, lockType, false, false);
    } else if (getMode == GetMode.NEXT_NODUP) {
        status = dup.getNextNoDup
                        (key, data, lockType, true, false);
    } else if (getMode == GetMode.PREV_NODUP) {
        status = dup.getNextNoDup
                        (key, data, lockType, false, false);
    } else {
        throw new InternalException("unknown GetMode");
    }
      } catch (DatabaseException DBE) {
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

     * endRead() to close the correct cursor.
     */
    private CursorImpl beginRead(boolean addCursor)
        throws DatabaseException {

        CursorImpl dup;
        if (cursorImpl.isNotInitialized()) {
            dup = cursorImpl;
        } else {
            dup = cursorImpl.cloneCursor(addCursor);
        }
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

        addRecords(start, end);

        /* Now reach into the tree and get the first BIN */
        Locker txn = new BasicLocker(DbInternal.envGetEnvironmentImpl(env));
        CursorImpl internalCursor = new CursorImpl(DbInternal.dbGetDatabaseImpl(db),
               txn);
        assertTrue(internalCursor.positionFirstOrLast(true, null));
        BIN firstBIN = internalCursor.getBIN();
        firstBIN.releaseLatch();
        internalCursor.close();
        txn.operationEnd();
        return firstBIN;
    }
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

     * to ensure that we're filling a file every time we write.
     */
    private long getFile(Cursor cursor)
        throws DatabaseException {

        CursorImpl impl = DbTestProxy.dbcGetCursorImpl(cursor);
        int index;
        BIN bin = impl.getDupBIN();
        if (bin != null) {
            index = impl.getDupIndex();
        } else {
            bin = impl.getBIN();
            assertNotNull(bin);
            index = impl.getIndex();
        }
        assertNotNull(bin.getTarget(index));
        long lsn = bin.getLsn(index);
        assertTrue(lsn != DbLsn.NULL_LSN);
        long file = DbLsn.getFileNumber(lsn);
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

     * Gets the LSN at the cursor position, using internal methods.
     */
    private long getLsn(Cursor cursor)
        throws DatabaseException {

        CursorImpl impl = DbTestProxy.dbcGetCursorImpl(cursor);
        BIN bin;
        int index;
        if (dups) {
            bin = impl.getDupBIN();
            index = impl.getDupIndex();
            if (bin == null) {
                bin = impl.getBIN();
                index = impl.getIndex();
                assertNotNull(bin);
            }
        } else {
            assertNull(impl.getDupBIN());
            bin = impl.getBIN();
            index = impl.getIndex();
            assertNotNull(bin);
        }
        assertTrue(index >= 0);
        long lsn = bin.getLsn(index);
        assertTrue(lsn != DbLsn.NULL_LSN);
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

    private void checkReadWriteLockCounts(Cursor cursor,
                                          int expectReadLocks,
                                          int expectWriteLocks)
        throws DatabaseException {

        CursorImpl cursorImpl = DbTestProxy.dbcGetCursorImpl(cursor);
        LockStats lockStats = cursorImpl.getLockStats();
        assertEquals(expectReadLocks, lockStats.getNReadLocks());
        assertEquals(expectWriteLocks, lockStats.getNWriteLocks());
        lockStats = env.getLockStats(null);
        assertEquals(initialEnvReadLocks + expectReadLocks,
                     lockStats.getNReadLocks());
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

        assert newSibling.isLatchOwner();
        assert this.isLatchOwner();
        int adjustmentDelta = (newSiblingHigh - newSiblingLow);
        Iterator iter = cursorSet.iterator();
        while (iter.hasNext()) {
            CursorImpl cursor = (CursorImpl) iter.next();
            if (getCursorBINToBeRemoved(cursor) == this) {

                /*
                 * This BIN will be removed from the cursor by CursorImpl
                 * following advance to next BIN; ignore it.
                 */
                continue;
            }
            int cIdx = getCursorIndex(cursor);
            BIN cBin = getCursorBIN(cursor);
            assert cBin == this :
                "nodeId=" + getNodeId() +
                " cursor=" + cursor.dumpToString(true);
            assert newSibling instanceof BIN;

            /*
             * There are four cases to consider for cursor adjustments,
             * depending on (1) how the existing node gets split, and
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

     */
    public void verifyCursors() {
        if (cursorSet != null) {
            Iterator iter = cursorSet.iterator();
            while (iter.hasNext()) {
                CursorImpl cursor = (CursorImpl) iter.next();
                if (getCursorBINToBeRemoved(cursor) != this) {
                    BIN cBin = getCursorBIN(cursor);
                    assert cBin == this;
                }
            }
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

        /* cursorSet may be null if this is being created through
           createFromLog() */
        if (cursorSet != null) {
            Iterator iter = cursorSet.iterator();
            while (iter.hasNext()) {
                CursorImpl cursor = (CursorImpl) iter.next();
                if (getCursorBINToBeRemoved(cursor) != this) {
                    int cIdx = getCursorIndex(cursor);
                    if (insertIndex <= cIdx) {
                        setCursorIndex(cursor, cIdx + 1);
                    }
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl

        /* cursorSet may be null if this is being created through
           createFromLog() */
        if (cursorSet != null) {
            Iterator iter = cursorSet.iterator();
            while (iter.hasNext()) {
                CursorImpl cursor = (CursorImpl) iter.next();
                if (getCursorBINToBeRemoved(cursor) != this &&
                    cursor != excludeCursor &&
                    cursor.getIndex() == binIndex) {
                    assert cursor.getDupBIN() == null;
                    cursor.addCursor(dupBin);
                    cursor.updateDBin(dupBin, dupBinIndex);
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.