Package com.sleepycat.je.tree

Examples of com.sleepycat.je.tree.IN


        INList inList = DbInternal.envGetEnvironmentImpl(env).getInMemoryINs();
        inList.latchMajor();
        try {
            Iterator iter = inList.iterator();
            while (iter.hasNext()) {
                IN in = (IN) iter.next();
                if (in instanceof BIN) {
                    BIN bin = (BIN) in;
                    bin.latch();
                    assertTrue(bin.evictLNs() > 0);
                    bin.releaseLatch();
View Full Code Here


        INList inList = envImpl.getInMemoryINs();
        inList.latchMajor();
        try {
            Iterator iter = inList.iterator();
            while (iter.hasNext()) {
                IN in = (IN) iter.next();
                System.out.println("in nodeId=" + in.getNodeId());
            }
        } finally {
            inList.releaseMajorLatch();
        }
    }
View Full Code Here

        }

        public IN doWork(ChildReference root)
            throws DatabaseException {

            IN rootIN = (IN) root.fetchTarget(database, null);
            readyToSplit = rootIN.needsSplitting();
            return null;
        }
View Full Code Here

        inList.latchMajor();
        try {
            Iterator iter = inList.iterator();
            while (iter.hasNext()) {
                IN in = (IN) iter.next();
                long size = in.getInMemorySize();
                totalSize += size;
            }
        } finally {
            inList.releaseMajorLatch();
        }
View Full Code Here

            /* consolidate the INList first. */
            inList.latchMinorAndDumpAddedINs();

      Iterator iter = inList.iterator();
      while (iter.hasNext()) {
    IN thisIN = (IN) iter.next();
    if (thisIN.getDatabase() == dbImpl) {
        foundSome = true;
        if (removeINsFromINList) {
      iter.remove();
                        memoryChange += (thisIN.getAccumulatedDelta() -
                                         thisIN.getInMemorySize());
                        thisIN.setInListResident(false);
        }
                    foundSet.add(thisIN);
    }
      }
        } catch (DatabaseException e) {
            /* Update the memory budget with any changes. */
            mb.updateTreeMemoryUsage(memoryChange);
            throw e;
  } finally {
      inList.releaseMajorLatch();
  }

        /*
         * Do processing outside of INList latch in order to reduce lockout
         * of checkpointing and eviction.
         */
        if (foundSome) {
            Iterator iter = foundSet.iterator();
            while (iter.hasNext()) {
                IN thisIN = (IN) iter.next();
                accumulateLSNs(thisIN);
            }
        }

        /*
 
View Full Code Here

    protected void walkInternal()
  throws DatabaseException {

  INList inList = envImpl.getInMemoryINs();
  IN root = null;
  if (!extractINsForDb(inList)) {
      if (rootLsn == DbLsn.NULL_LSN) {
    return;
      }
View Full Code Here

    private BIN searchForBIN(DatabaseImpl db, byte[] mainKey, byte[] dupKey)
        throws DatabaseException {

        /* Search for this IN */
        Tree tree = db.getTree();
        IN in = tree.search
            (mainKey, SearchType.NORMAL, -1, null, false /*updateGeneration*/);

        /* Couldn't find a bin, return null */
        if (in == null) {
            return null;
View Full Code Here

        }

        public IN doWork(ChildReference root)
            throws DatabaseException {
           
            IN rootIN = (IN) root.fetchTarget(db, null);
            rootLevel = rootIN.getLevel();
            return null;
        }
View Full Code Here

             * list.
             */
            while ((evictBytes < requiredEvictBytes) &&
                   (nNodesScannedThisRun <= inListStartSize)) {

                IN target = selectIN(inList, scanIter);

                if (target == null) {
                    break;
                } else {
                    assert evictProfile.count(target);//intentional side effect
View Full Code Here

     */
    private IN selectIN(INList inList, ScanIterator scanIter)
        throws DatabaseException {

        /* Find the best target in the next <nodesPerScan> nodes. */
        IN target = null;
        long targetGeneration = Long.MAX_VALUE;
        int targetLevel = Integer.MAX_VALUE;
        boolean targetDirty = true;
  boolean envIsReadOnly = envImpl.isReadOnly();
        int scanned = 0;
        boolean wrapped = false;
        while (scanned < nodesPerScan) {
            if (scanIter.hasNext()) {
                IN in = scanIter.next();
                nNodesScannedThisRun++;

                DatabaseImpl db = in.getDatabase();

                /*
                 * We don't expect to see an IN with a database that has
                 * finished delete processing, because it would have been
                 * removed from the inlist during post-delete cleanup.
                 */
                if (db == null || db.isDeleteFinished()) {
                    String inInfo = " IN type=" + in.getLogType() + " id=" +
                        in.getNodeId() + " not expected on INList";
                    String errMsg = (db == null) ? inInfo :
                        "Database " + db.getDebugName() + " id=" + db.getId() +
                        inInfo;
                    throw new DatabaseException(errMsg);
                }

                /* Ignore if the db is in the middle of delete processing. */
                if (db.isDeleted()) {
                    continue;
                }

                /*
                 * Don't evict the DatabaseImpl Id Mapping Tree (db 0), both
                 * for object identity reasons and because the id mapping tree
                 * should stay cached.
                 */
                if (db.getId().equals(DbTree.ID_DB_ID)) {
                    continue;
                }

                /*
                 * If this is a read only database and we have at least one
                 * target, skip any dirty INs (recovery dirties INs even in a
                 * read-only environment). We take at least one target so we
                 * don't loop endlessly if everything is dirty.
                 */
                if (envIsReadOnly && (target != null) && in.getDirty()) {
                    continue;
                }

                /*
                 * Only scan evictable or strippable INs.  This prevents higher
                 * level INs from being selected for eviction, unless they are
                 * part of an unused tree.
                 */
                int evictType = in.getEvictionType();
                if (evictType == IN.MAY_NOT_EVICT) {
                    continue;
                }

                /*
                 * This node is in the scanned node set.  Select according to
                 * the configured eviction policy.
                 */
                if (evictByLruOnly) {

                    /*
                     * Select the node with the lowest generation number,
                     * irrespective of tree level or dirtyness.
                     */
                    if (targetGeneration > in.getGeneration()) {
                        targetGeneration = in.getGeneration();
                        target = in;
                    }
                } else {

                    /*
                     * Select first by tree level, then by dirtyness, then by
                     * generation/LRU.
                     */
                    int level = normalizeLevel(in, evictType);
                    if (targetLevel != level) {
                        if (targetLevel > level) {
                            targetLevel = level;
                            targetDirty = in.getDirty();
                            targetGeneration = in.getGeneration();
                            target = in;
                        }
                    } else if (targetDirty != in.getDirty()) {
                        if (targetDirty) {
                            targetDirty = false;
                            targetGeneration = in.getGeneration();
                            target = in;
                        }
                    } else {
                        if (targetGeneration > in.getGeneration()) {
                            targetGeneration = in.getGeneration();
                            target = in;
                        }
                    }
                }
                scanned++;
View Full Code Here

TOP

Related Classes of com.sleepycat.je.tree.IN

Copyright © 2018 www.massapicom. 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.