Examples of DupCountLN


Examples of com.sleepycat.je.tree.DupCountLN

        if (n != null && n.containsDuplicates()) {
            DIN dupRoot = (DIN) n;
            /* Latch couple down the tree. */
            dupRoot.latch();
      releaseBIN();
            DupCountLN dupCountLN = (DupCountLN)
                dupRoot.getDupCountLNRef().fetchTarget(database, dupRoot);
            /* We can't hold latches when we acquire locks. */
            dupRoot.releaseLatch();
            getReadLock(dupCountLN, LockType.READ);
            dupRootCount = dupCountLN.getDupCount();
        } else {
      releaseBIN();
        }

        return dupRootCount;
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

             * Save a reference to the affected parent of this LN to place on
             * the delete info queue when the txn commits. If this is a
             * duplicate tree, we also have to update the duplicate tree count.
             */
            ChildReference dupCountRef = dupRoot.getDupCountLNRef();
            DupCountLN dcl = (DupCountLN)
                dupCountRef.fetchTarget(database, dupRoot);
            dupRoot.releaseLatch();
            LockResult dclGrantAndInfo = locker.lock
                (dcl.getNodeId(), LockType.WRITE, database);
            /*
             * The write lock request might have blocked while waiting for a
             * transaction that changed the oldLsn.  Re-get the reference to
             * the LN and get the old (abort) LSN out of it.
             */
            latchBIN();
            dupRoot = (DIN) bin.fetchTarget(index);
            dupRoot.latch();
            releaseBIN();
            dupCountRef = dupRoot.getDupCountLNRef();
            long oldDclLsn = dupCountRef.getLsn();
            dclGrantAndInfo.setAbortLsn(oldDclLsn,
                                        dupCountRef.isKnownDeleted());
            dcl = (DupCountLN) dupCountRef.fetchTarget(database, dupRoot);
            dcl.decDupCount();
      assert dcl.getDupCount() >= 0;
            EnvironmentImpl envImpl = database.getDbEnvironment();
            long dupCountLsn =
                dcl.log(envImpl, database.getId(), dupKey, oldDclLsn, locker);
            dupRoot.updateDupCountLNRef(dupCountLsn);
            dupRoot.releaseLatch();

            locker.addDeleteInfo(dupBin, new Key(lnKey));
        } else {
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

                    try {
                        duplicateRoot = (DIN) bin.fetchTarget(index);
                        TreeWalkerStatsAccumulator treeStatsAccumulator =
                            getTreeStatsAccumulator();
                        if (treeStatsAccumulator != null) {
                            DupCountLN dcl = duplicateRoot.getDupCountLN();
                            if (dcl != null) {
                                dcl.accumulateStats(treeStatsAccumulator);
                            }
                        }
                    } finally {
                        releaseBIN();
                    }
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

                DIN dupRoot = (DIN) n;

                /* Latch couple down the tree. */
                dupRoot.latch();
                releaseBIN();
                DupCountLN dupCountLN = (DupCountLN)
                    dupRoot.getDupCountLNRef().fetchTarget(database, dupRoot);

                /* We can't hold latches when we acquire locks. */
                dupRoot.releaseLatch();

                /*
                 * Call lock directly.  There is no need to call lockLN because
                 * the node ID cannot change (a slot cannot be reused) for a
                 * DupCountLN.
                 */
                if (lockType != LockType.NONE) {
                    locker.lock
                        (dupCountLN.getNodeId(), lockType, false /*noWait*/,
                         database);
                }
                return dupCountLN.getDupCount();
            } else {
                /* If an LN is in the slot, the count is one. */
                return 1;
            }
        } finally {
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

                            }

                            DIN duplicateRoot = (DIN) bin.fetchTarget(index);
                            duplicateRoot.latch();
                            try {
                                DupCountLN dcl = duplicateRoot.getDupCountLN();
                                if (dcl != null) {
                                    dcl.accumulateStats(treeStatsAccumulator);
                                }
                            } finally {
                                duplicateRoot.releaseLatch();
                            }
                        } finally {
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

     * @return the LockResult containing the LN that was locked.
     */
    public LockResult lockDupCountLN(DIN dupRoot, LockType lockType)
  throws DatabaseException {

        DupCountLN ln = dupRoot.getDupCountLN();
        LockResult lockResult;

        /*
         * Try a non-blocking lock first, to avoid unlatching.  If the default
         * is no-wait, use the standard lock method so LockNotHeldException is
         * thrown; there is no need to try a non-blocking lock twice.
         */
        if (locker.getDefaultNoWait()) {
            lockResult = locker.lock
                (ln.getNodeId(), lockType, true /*noWait*/, database);
        } else {
            lockResult = locker.nonBlockingLock
                (ln.getNodeId(), lockType, database);
        }

        if (lockResult.getLockGrant() == LockGrantType.DENIED) {
            /* Release all latches. */
            dupRoot.releaseLatch();
            releaseBINs();
            /* Request a blocking lock. */
            lockResult = locker.lock
                (ln.getNodeId(), lockType, false /*noWait*/, database);
            /* Reacquire all latches. */
            latchBIN();
            dupRoot = (DIN) bin.fetchTarget(index);
            dupRoot.latch();
            latchDBIN();
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

                DIN dupRoot = (DIN) n;

                /* Latch couple down the tree. */
                dupRoot.latch(cacheMode);
                releaseBIN();
                DupCountLN dupCountLN = (DupCountLN)
                    dupRoot.getDupCountLNRef().fetchTarget(databaseImpl,
                                                           dupRoot);

                /* We can't hold latches when we acquire locks. */
                dupRoot.releaseLatch();

                /*
                 * Call lock directly.  There is no need to call lockLN because
                 * the node ID cannot change (a slot cannot be reused) for a
                 * DupCountLN.
                 */
                locker.lock
                    (dupCountLN.getNodeId(), lockType, false /*noWait*/,
                     databaseImpl);
                return dupCountLN.getDupCount();
            } else {
                /* If an LN is in the slot, the count is one. */
                return 1;
            }
        } finally {
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

                            }

                            DIN duplicateRoot = (DIN) bin.fetchTarget(index);
                            duplicateRoot.latch(cacheMode);
                            try {
                                DupCountLN dcl = duplicateRoot.getDupCountLN();
                                if (dcl != null) {
                                    dcl.accumulateStats(treeStatsAccumulator);
                                }
                            } finally {
                                duplicateRoot.releaseLatch();
                            }
                        } finally {
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

     * @return the LockResult containing the LN that was locked.
     */
    public LockResult lockDupCountLN(DIN dupRoot, LockType lockType)
        throws DatabaseException {

        DupCountLN ln = dupRoot.getDupCountLN();
        LockResult lockResult;

        /*
         * Try a non-blocking lock first, to avoid unlatching.  If the default
         * is no-wait, use the standard lock method so
         * LockNotAvailableException is thrown; there is no need to try a
         * non-blocking lock twice.
         */
        if (locker.getDefaultNoWait()) {
            try {
                lockResult = locker.lock
                    (ln.getNodeId(), lockType, true /*noWait*/, databaseImpl);
            } catch (LockConflictException e) {
                /*
                 * Release all latches.  Note that we catch
                 * LockConflictException for simplicity but we expect either
                 * LockNotAvailableException or LockNotGrantedException.
                 */
                dupRoot.releaseLatch();
                releaseBINs();
                throw e;
            }
        } else {
            lockResult = locker.nonBlockingLock
                (ln.getNodeId(), lockType, databaseImpl);
        }

        if (lockResult.getLockGrant() == LockGrantType.DENIED) {
            /* Release all latches. */
            dupRoot.releaseLatch();
            releaseBINs();
            /* Request a blocking lock. */
            lockResult = locker.lock
                (ln.getNodeId(), lockType, false /*noWait*/, databaseImpl);
            /* Reacquire all latches. */
            latchBIN();
            dupRoot = (DIN) bin.fetchTarget(index);
            dupRoot.latch(cacheMode);
            latchDBIN();
View Full Code Here

Examples of com.sleepycat.je.tree.DupCountLN

        if (isDINRoot) {
            DIN din = (DIN) in;
            ChildReference dupCountLNRef = din.getDupCountLNRef();
            long lsn = dupCountLNRef.getLsn();
            if (lsn == DbLsn.NULL_LSN) {
                DupCountLN dcl = din.getDupCountLN();
                callback.processDupCount(dcl.getDupCount());
            } else {
                /* Negative index signifies a DupCountLN. */
                addToLsnINMap(Long.valueOf(lsn), in, -1);
                Node node = fetchLSNHandleExceptions(lsn, lnKeyEntry);
                if (node != null) {
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.