Examples of TreeWalkerStatsAccumulator


Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

            return null;
        }
    }

    public void incrementLNCount() {
        TreeWalkerStatsAccumulator treeStatsAccumulator =
            getTreeStatsAccumulator();
        if (treeStatsAccumulator != null) {
            treeStatsAccumulator.incrementLNCount();
        }
    }
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

                bin = (BIN) in;
                index = (first ? 0 : (bin.getNEntries() - 1));
                addCursor(bin);

                TreeWalkerStatsAccumulator treeStatsAccumulator =
                    getTreeStatsAccumulator();

                if (bin.getNEntries() == 0) {

                    /*
                     * An IN was found. Even if it's empty, let Cursor
                     * handle moving to the first non-deleted entry.
                     */
                    found = true;
                } else {

                    if (treeStatsAccumulator != null &&
                        !bin.isEntryKnownDeleted(index) &&
                        !bin.isEntryPendingDeleted(index)) {
                        treeStatsAccumulator.incrementLNCount();
                    }

                    /*
                     * Even if the entry is deleted, just leave our
                     * position here and return.
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

    private OperationStatus fetchCurrent(DatabaseEntry foundKey,
                                         DatabaseEntry foundData,
                                         LockType lockType)
        throws DatabaseException {

        TreeWalkerStatsAccumulator treeStatsAccumulator =
            getTreeStatsAccumulator();

        if (bin == null) {
            return OperationStatus.NOTFOUND;
        }

        assert bin.isLatchOwnerForWrite();

        /*
         * If we encounter a deleted entry, opportunistically add it to the
         * compressor queue.
         */
        if (index >= 0 && index < bin.getNEntries() &&
            (bin.isEntryKnownDeleted(index) ||
             bin.isEntryPendingDeleted(index))) {
            bin.queueSlotDeletion();
        }

        /*
         * Check the deleted flag in the BIN and make sure this isn't an empty
         * BIN.  The BIN could be empty by virtue of the compressor running the
         * size of this BIN to 0 but not having yet deleted it from the tree.
         *
         * The index may be negative if we're at an intermediate stage in an
         * higher level operation, and we expect a higher level method to do a
         * next or prev operation after this returns KEYEMPTY. [#11700]
         */
        if (index < 0 ||
            index >= bin.getNEntries() ||
            bin.isEntryKnownDeleted(index)) {
            /* Node is no longer present. */
            if (treeStatsAccumulator != null) {
                treeStatsAccumulator.incrementDeletedLNCount();
            }
            return OperationStatus.KEYEMPTY;
        }

        /*
         * We don't need to fetch the LN if the user has not requested that we
         * return the data. The key may still be returned, and it is available
         * in the BIN.
         */
        final boolean mustFetch =
            foundData != null &&
            (!foundData.getPartial() || foundData.getPartialLength() != 0);

        /*
         * Note that since we have the BIN latched, we can safely check the
         * node type.
         */
        addCursor(bin);

        assert TestHookExecute.doHookIfSet(testHook);

        /*
         * Lock the LN.  For dirty-read, the data of the LN can be set to null
         * at any time.  Cache the data in a local variable so its state does
         * not change before calling LN.setEntry further below.
         */
        final LockStanding lockStanding = lockLN(lockType);
        if (!lockStanding.recordExists()) {
            revertLock(lockStanding);
            if (treeStatsAccumulator != null) {
                treeStatsAccumulator.incrementDeletedLNCount();
            }
            return OperationStatus.KEYEMPTY;
        }
        final LN ln = (LN) (mustFetch ?  bin.fetchTarget(index) : null);
        byte[] lnData = (ln != null) ? ln.getData() : null;
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

      return null;
  }
    }

    public void incrementLNCount() {
        TreeWalkerStatsAccumulator treeStatsAccumulator =
      getTreeStatsAccumulator();
  if (treeStatsAccumulator != null) {
      treeStatsAccumulator.incrementLNCount();
  }
    }
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

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

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

                    dupIndex = -1;
                    bin = (BIN) in;
                    index = (first ? 0 : (bin.getNEntries() - 1));
                    addCursor(bin);

                    TreeWalkerStatsAccumulator treeStatsAccumulator =
                        getTreeStatsAccumulator();

                    if (bin.getNEntries() == 0) {

                        /*
                         * An IN was found. Even if it's empty, let Cursor
                         * handle moving to the first non-deleted entry.
                         */
                        found = true;
                    } else {

                        /*
                         * See if we need to descend further.  If fetchTarget
                         * returns null, a deleted LN was cleaned.
                         */
                        Node n = null;
                        if (!in.isEntryKnownDeleted(index)) {
                            n = in.fetchTarget(index);
                        }

                        if (n != null && n.containsDuplicates()) {
                            DIN dupRoot = (DIN) n;
                            dupRoot.latch();
                            in.releaseLatch();
                            in = null;
                            found = positionFirstOrLast(first, dupRoot);
                        } else {

                            /*
                             * Even if the entry is deleted, just leave our
                             * position here and return.
                             */
                            if (treeStatsAccumulator != null) {
                                if (n == null || ((LN) n).isDeleted()) {
                                    treeStatsAccumulator.
                                        incrementDeletedLNCount();
                                } else {
                                    treeStatsAccumulator.
                                        incrementLNCount();
                                }
                            }
                            found = true;
                        }
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

           DatabaseEntry foundData,
           LockType lockType,
           boolean first)
        throws DatabaseException {

        TreeWalkerStatsAccumulator treeStatsAccumulator =
      getTreeStatsAccumulator();

        boolean duplicateFetch = setTargetBin();
        if (targetBin == null) {
            return OperationStatus.NOTFOUND;
        }

        assert targetBin.isLatchOwner();

        /*
   * Check the deleted flag in the BIN and make sure this isn't an empty
   * BIN.  The BIN could be empty by virtue of the compressor running the
   * size of this BIN to 0 but not having yet deleted it from the tree.
         *
         * The index may be negative if we're at an intermediate stage in an
         * higher level operation, and we expect a higher level method to do a
         * next or prev operation after this returns KEYEMPTY. [#11700]
   */
        Node n = null;

        if (targetIndex < 0 ||
            targetIndex >= targetBin.getNEntries() ||
      targetBin.isEntryKnownDeleted(targetIndex)) {
            /* Node is no longer present. */
        } else {

      /*
       * If we encounter a pendingDeleted entry, add it to the compressor
       * queue.
       */
      if (targetBin.isEntryPendingDeleted(targetIndex)) {
    EnvironmentImpl envImpl = database.getDbEnvironment();
    envImpl.addToCompressorQueue
        (targetBin, new Key(targetBin.getKey(targetIndex)), false);
      }

            /* If fetchTarget returns null, a deleted LN was cleaned. */
      try {
    n = targetBin.fetchTarget(targetIndex);
      } catch (DatabaseException DE) {
    targetBin.releaseLatchIfOwner();
    throw DE;
      }
        }
        if (n == null) {
      if (treeStatsAccumulator != null) {
    treeStatsAccumulator.incrementDeletedLNCount();
      }
            targetBin.releaseLatchIfOwner();
            return OperationStatus.KEYEMPTY;
        }

        /*
         * Note that since we have the BIN/DBIN latched, we can safely check
         * the node type. Any conversions from an LN to a dup tree must have
         * the bin latched.
         */
        addCursor(targetBin);
        if (n.containsDuplicates()) {
            assert !duplicateFetch;
            /* Descend down duplicate tree, doing latch coupling. */
            DIN duplicateRoot = (DIN) n;
            duplicateRoot.latch();
            targetBin.releaseLatch();
            if (positionFirstOrLast(first, duplicateRoot)) {
    try {
        return fetchCurrent(foundKey, foundData, lockType, first);
    } catch (DatabaseException DE) {
        releaseBINs();
        throw DE;
    }
            } else {
                return OperationStatus.NOTFOUND;
            }
        }

        LN ln = (LN) n;

  assert TestHookExecute.doHookIfSet(testHook);

        /*
         * Lock the LN (will unlatch).  For dirty-read, the data of the LN can
         * be set to null at any time.  Cache the data in a local variable so
         * its state does not change before calling setDbt further below.
         */
  LockResult lockResult = lockLN(ln, lockType);
  ln = lockResult.getLN();
        byte[] lnData = (ln != null) ? ln.getData() : null;
        if (ln == null || lnData == null) {
            if (treeStatsAccumulator != null) {
                treeStatsAccumulator.incrementDeletedLNCount();
            }
            return OperationStatus.KEYEMPTY;
        }

  latchBINs();
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

      return null;
  }
    }

    public void incrementLNCount() {
        TreeWalkerStatsAccumulator treeStatsAccumulator =
      getTreeStatsAccumulator();
  if (treeStatsAccumulator != null) {
      treeStatsAccumulator.incrementLNCount();
  }
    }
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

        dupBinToBeRemoved = dupBin;

        dupBin = null;
        dupBinToBeRemoved.releaseLatch();
               
                    TreeWalkerStatsAccumulator treeStatsAccumulator =
                        getTreeStatsAccumulator();
                    if (treeStatsAccumulator != null) {
                        latchBIN();
                        try {
                            if (index < 0) {
View Full Code Here

Examples of com.sleepycat.je.tree.TreeWalkerStatsAccumulator

                    dupIndex = -1;
                    bin = (BIN) in;
                    index = (first ? 0 : (bin.getNEntries() - 1));
                    addCursor(bin);

                    TreeWalkerStatsAccumulator treeStatsAccumulator =
                        getTreeStatsAccumulator();

                    if (bin.getNEntries() == 0) {

                        /*
                         * An IN was found. Even if it's empty, let Cursor
                         * handle moving to the first non-deleted entry.
                         */
                        found = true;
                    } else {

                        /*
                         * See if we need to descend further.  If fetchTarget
                         * returns null, a deleted LN was cleaned.
                         */
                        Node n = null;
                        if (!in.isEntryKnownDeleted(index)) {
                            n = in.fetchTarget(index);
                        }

                        if (n != null && n.containsDuplicates()) {
                            DIN dupRoot = (DIN) n;
                            dupRoot.latch();
                            in.releaseLatch();
                            in = null;
                            found = positionFirstOrLast(first, dupRoot);
                        } else {

                            /*
                             * Even if the entry is deleted, just leave our
                             * position here and return.
                             */
                            if (treeStatsAccumulator != null) {
                                if (n == null || ((LN) n).isDeleted()) {
                                    treeStatsAccumulator.
                                        incrementDeletedLNCount();
                                } else {
                                    treeStatsAccumulator.
                                        incrementLNCount();
                                }
                            }
                            found = true;
                        }
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.