Examples of KeyChangeStatus


Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

                           SearchMode searchMode)
        throws DatabaseException {

        if (!isSerializableIsolation(lockMode)) {
            LockType lockType = getLockType(lockMode, false);
            KeyChangeStatus result = searchAllowPhantoms
                (key, data, lockType, lockType, searchMode);
            return result.status;
        }

        /* Perform range locking to prevent phantoms and handle restarts. */
        while (true) {
            try {
                /* Do not use a range lock for the initial search. */
                LockType searchLockType = getLockType(lockMode, false);

                /* Switch to a range lock when advancing forward. */
                LockType advanceLockType = getLockType(lockMode, true);

                /* Do not modify key/data params until SUCCESS. */
                DatabaseEntry tryKey = new DatabaseEntry
                    (key.getData(), key.getOffset(), key.getSize());
                DatabaseEntry tryData = new DatabaseEntry
                    (data.getData(), data.getOffset(), data.getSize());
                KeyChangeStatus result;

                if (searchMode.isExactSearch()) {
                    /* Artificial range search to range lock the next key. */
                    result = searchExactAndRangeLock
                        (tryKey, tryData, searchLockType, advanceLockType,
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

        /* Convert exact search to range search. */
        searchMode = (searchMode == SearchMode.SET) ?
            SearchMode.SET_RANGE : SearchMode.BOTH_RANGE;

        KeyChangeStatus result = null;
        boolean noNextKeyFound;

        CursorImpl dup =
            beginRead(false /* searchAndPosition will add cursor */);

View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

        CursorImpl dup =
            beginRead(false /* searchAndPosition will add cursor */);

        try {
            KeyChangeStatus result = searchInternal
                (dup, key, data, searchLockType, advanceLockType, searchMode);

            status = result.status;
            return result;
        } finally {
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

                         * This may be a deleted record or a rangeMatch, and in
                         * either case we should advance.  We must determine
                         * whether the key changes when we advance.
                         */
                        if (exactKeyMatch) {
                            KeyChangeStatus result =
                                dup.getNextWithKeyChangeStatus
                                (key, data, advanceLockType, true, rangeMatch);
                            status = result.status;

                            /*
                             * For BOTH_RANGE, advancing always causes a data
                             * change, which is considered a key change.  For
                             * SET_RANGE, getNextWithKeyChangeStatus determined
                             * the key change status.
                             */
                            keyChange = searchMode.isDataSearch() ?
                                (status == OperationStatus.SUCCESS) :
                                result.keyChange;
                        } else {

                            /*
                             * If we didn't match the key, skip over duplicates
                             * to the next key with getNextNoDup.
                             */
                            status = dup.getNextNoDup
                                (key, data, advanceLockType, true, rangeMatch);
                           
                            /* getNextNoDup always causes a key change. */
                            keyChange = (status == OperationStatus.SUCCESS);
                        }
                    }
                }
            }
        } finally {

            /*
             * searchAndPosition returns with the target BIN latched, so it is
             * the responsibility of this method to make sure the latches are
             * released.
             */
            cursorImpl.releaseBINs();
            if (status != OperationStatus.SUCCESS && dup != cursorImpl) {
                dup.releaseBINs();
            }
        }
       
        return new KeyChangeStatus(status, keyChange);
    }
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

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

      try {
                KeyChangeStatus result = dup.getNextWithKeyChangeStatus
                    (tryKey, tryData, lockType, true, false);
                status = result.status;
                noNextKeyFound = (status != OperationStatus.SUCCESS);
                if (result.keyChange && status == OperationStatus.SUCCESS) {
                    status = OperationStatus.NOTFOUND;
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

                           SearchMode searchMode)
        throws DatabaseException {

        if (!isSerializableIsolation(lockMode)) {
            LockType lockType = getLockType(lockMode, false);
            KeyChangeStatus result = searchAllowPhantoms
                (key, data, lockType, lockType, searchMode);
            return result.status;
        }

        /* Perform range locking to prevent phantoms and handle restarts. */
        while (true) {
            try {
                /* Do not use a range lock for the initial search. */
                LockType searchLockType = getLockType(lockMode, false);

                /* Switch to a range lock when advancing forward. */
                LockType advanceLockType = getLockType(lockMode, true);

                /* Do not modify key/data params until SUCCESS. */
                DatabaseEntry tryKey = new DatabaseEntry
                    (key.getData(), key.getOffset(), key.getSize());
                DatabaseEntry tryData = new DatabaseEntry
                    (data.getData(), data.getOffset(), data.getSize());
                KeyChangeStatus result;

                if (searchMode.isExactSearch()) {
                    /* Artificial range search to range lock the next key. */
                    result = searchExactAndRangeLock
                        (tryKey, tryData, searchLockType, advanceLockType,
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

        /* Convert exact search to range search. */
        searchMode = (searchMode == SearchMode.SET) ?
            SearchMode.SET_RANGE : SearchMode.BOTH_RANGE;

        KeyChangeStatus result = null;
        boolean noNextKeyFound;

        CursorImpl dup =
            beginRead(false /* searchAndPosition will add cursor */);

View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

        CursorImpl dup =
            beginRead(false /* searchAndPosition will add cursor */);

        try {
            KeyChangeStatus result = searchInternal
                (dup, key, data, searchLockType, advanceLockType, searchMode,
                 false /*advanceAfterRangeSearch*/);

            status = result.status;
            return result;
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

                         * This may be a deleted record or a rangeMatch, and in
                         * either case we should advance.  We must determine
                         * whether the key changes when we advance.
                         */
                        if (exactKeyMatch) {
                            KeyChangeStatus result =
                                dup.getNextWithKeyChangeStatus
                                (key, data, advanceLockType, true, rangeMatch);
                            status = result.status;

                            /*
                             * For BOTH_RANGE, advancing always causes a data
                             * change, which is considered a key change.  For
                             * SET_RANGE, getNextWithKeyChangeStatus determined
                             * the key change status.
                             */
                            keyChange = searchMode.isDataSearch() ?
                                (status == OperationStatus.SUCCESS) :
                                result.keyChange;

                        } else if (searchMode.isDataSearch() &&
                                   !advanceAfterRangeSearch) {

                            /*
                             * If we did not match the key (exactly) for
                             * BOTH_RANGE, and advanceAfterSearchRangeBoth is
                             * false, then return NOTFOUND.
                             */
                             status = OperationStatus.NOTFOUND;
                        } else {

                            /*
                             * If we didn't match the key, skip over duplicates
                             * to the next key with getNextNoDup.
                             */
                            status = dup.getNextNoDup
                                (key, data, advanceLockType, true, rangeMatch);
                           
                            /* getNextNoDup always causes a key change. */
                            keyChange = (status == OperationStatus.SUCCESS);
                        }

                        /*
                         * If we moved past the search key after a BOTH_RANGE
                         * search, return NOTFOUND.  Leave the keyChange value
                         * intact, since we want to return this accurately
                         * regardless of the status return.
                         */
                        if (status == OperationStatus.SUCCESS &&
                            searchMode.isDataSearch()) {
                            if (Key.compareKeys
                                (key.getData(), searchKey,
                                 dbImpl.getDuplicateComparator()) != 0) {
                                status = OperationStatus.NOTFOUND;
                            }
                        }
                    }
                }
            }
        } finally {

            /*
             * searchAndPosition returns with the target BIN latched, so it is
             * the responsibility of this method to make sure the latches are
             * released.
             */
            cursorImpl.releaseBINs();
            if (status != OperationStatus.SUCCESS && dup != cursorImpl) {
                dup.releaseBINs();
            }
        }
       
        return new KeyChangeStatus(status, keyChange);
    }
View Full Code Here

Examples of com.sleepycat.je.dbi.CursorImpl.KeyChangeStatus

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

      try {
                KeyChangeStatus result = dup.getNextWithKeyChangeStatus
                    (tryKey, tryData, lockType, true, false);
                status = result.status;
                noNextKeyFound = (status != OperationStatus.SUCCESS);
                if (result.keyChange && status == OperationStatus.SUCCESS) {
                    status = OperationStatus.NOTFOUND;
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.