Package com.sleepycat.je.tree

Examples of com.sleepycat.je.tree.Tree


                 * nameLN refer to the id of the new database.
                 */
                DatabaseId newId = new DatabaseId(getNextDbId());
                DatabaseImpl newDb = (DatabaseImpl) result.dbImpl.clone();
                newDb.setId(newId);
                newDb.setTree(new Tree(newDb));
           
                /*
                 * Insert the new MapLN into the id tree. Always use
                 * an AutoTxn on the id databaase, because we can not
                 * hold long term locks on the mapLN.
View Full Code Here


             */
            DatabaseImpl newDb;
            DatabaseId newId = new DatabaseId(getNextDbId());
      newDb = (DatabaseImpl) oldDatabase.clone();
            newDb.setId(newId);
            newDb.setTree(new Tree(newDb));
           
            /* Insert the new db into id -> name map */
            CursorImpl idCursor = null;
            boolean operationOk = false;
            AutoTxn autoTxn = null;
View Full Code Here

                 * If we were able to free any memory by LN stripping above,
                 * then we postpone eviction of the BIN until a later pass.
                 */
                if (evictedBytes == 0 && target.isEvictable()) {
                    /* Regular eviction. */
                    Tree tree = target.getDatabase().getTree();

                    /* getParentINForChildIN unlatches target. */
                    SearchResult result =
                        tree.getParentINForChildIN
                            (target,
                             true,   // requireExactMatch
                             false); // updateGeneration
                    if (result.exactParentFound) {
                        evictedBytes =  evictIN(target, result.parent,
View Full Code Here

        /*
         * The tree needs the env, make sure we assign it before
         * allocating the tree.
         */
        tree = new Tree(this);
        referringHandles = Collections.synchronizedSet(new HashSet());

        eofNodeId = Node.getNextNodeId();

        /* For error messages only. */
 
View Full Code Here

        id = new DatabaseId();
        envImpl = null;

        isDeleted = false;
        tree = new Tree();
        referringHandles = Collections.synchronizedSet(new HashSet());

        /* initDefaultSettings is called after envImpl is set.  */

        eofNodeId = Node.getNextNodeId();
View Full Code Here

     * the tree.
     */
    protected void verifyEntries(Hashtable dataMap)
  throws DatabaseException {

  Tree tree = DbInternal.dbGetDatabaseImpl(exampleDb).getTree();
  Enumeration e = dataMap.keys();
  while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      if (!retrieveData(tree, key.getBytes())) {
    System.out.println("Couldn't find: " + key);
View Full Code Here

     */
    public static void logBINAndIN(Environment env, Cursor cursor)
        throws DatabaseException {

        BIN bin = getBIN(cursor);
        Tree tree = bin.getDatabase().getTree();
        bin.latch();
        SearchResult result = tree.getParentINForChildIN(bin, true, true);
        assert result.parent != null;
        result.parent.releaseLatch();
        assert result.exactParentFound;
        IN in = result.parent;
        long binLsn = logIN(env, bin, true, in);
View Full Code Here

     * Returns the parent IN of the given BIN.
     */
    public static IN getIN(BIN bin)
        throws DatabaseException {

        Tree tree = bin.getDatabase().getTree();
        bin.latch();
        SearchResult result = tree.getParentINForChildIN(bin, true, true);
        assert result.parent != null;
        result.parent.releaseLatch();
        assert result.exactParentFound;
        return result.parent;
    }
View Full Code Here

        CheckpointConfig ckptConfig = new CheckpointConfig();
        ckptConfig.setForce(true);
        env.checkpoint(ckptConfig);

        Tree tree = DbInternal.dbGetDatabaseImpl(db).getTree();
        com.sleepycat.je.tree.Key.DUMP_INT_BINDING = true;
        if (DEBUG) {
            tree.dump();
        }

        /*
         * Update a key on the BIN3 and a key on BIN4, to create reason for
         * a BINDelta. Force a BINDelta for BIN3 and BIN4 out to the log.
         */
        IntegerBinding.intToEntry(0, key);
        IntegerBinding.intToEntry(100, data);
        assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
        IntegerBinding.intToEntry(20, key);
        assertEquals(OperationStatus.SUCCESS, db.put(null, key, data));
       
        EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
        BIN bin = (BIN)tree.getFirstNode();
        bin.log(envImpl.getLogManager(), true, false, false, null);
        bin = tree.getNextBin(bin, null);
        bin.log(envImpl.getLogManager(), true, false, false, null);
        bin.releaseLatch();

        /*
         * Delete all of left hand side of the tree, so that the subtree root
         * headed by IN2 is compressed.
         */
        for (int i = 0; i < 50; i+=10) {
            IntegerBinding.intToEntry(i, key);
            assertEquals(OperationStatus.SUCCESS, db.delete(null, key));
        }

        /* force a compression */
        env.compress();
        if (DEBUG) {
            tree.dump();
        }
    }
View Full Code Here

        throws DatabaseException {

        INList inList = env.getInMemoryINs();
        boolean requeued = false;
        try {
            Tree tree = dbImpl.getTree();
           
            if (containsDups) {
               
                /*
                 * When we delete a BIN or DBIN, we're guaranteed that there
                 * are no cursors at that node. (otherwise, we wouldn't be able
                 * to remove all the entries. However, there's the possibility
                 * that the BIN that is the parent of the duplicate tree has
                 * resident cursors, and in that case, we would not be able
                 * to remove the whole duplicate tree and DIN root. In that
                 * case, we'd requeue.
                 */
                boolean deleteFinished = false;
                inList.latchMajor();
                try {
                    deleteFinished = tree.deleteDup(idKey, dupKey, tracker);
                } finally {
                    inList.releaseMajorLatch();
                }

                if (deleteFinished) {
                    processedBinsThisRun++;
                } else {

                    /*
                     * Requeue, there were cursors on the BIN parent of the
                     * duplicate tree.
                     */
                    addBinRefToQueue(binRef, false);
                    requeued = true;
                    cursorsBinsThisRun++;
                }
            } else {
                boolean deletedRoot = false;
                inList.latchMajor();
                try {
                    deletedRoot = tree.delete(idKey, tracker);
                } finally {
                    inList.releaseMajorLatch();
                }

                /*
 
View Full Code Here

TOP

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

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.