Examples of Bin


Examples of com.sleepycat.je.tree.BIN

        }

        /* We need to descend down into a duplicate tree. */
        DIN duplicateRoot = null;
        DBIN duplicateBin = null;
        BIN bin = (BIN) in;
        try {
            int index = bin.findEntry(mainKey, false, true);
            if (index >= 0) {
                Node node = null;
    if (!bin.isEntryKnownDeleted(index)) {
                    /* If fetchTarget returns null, a deleted LN was cleaned. */
                    node = bin.fetchTarget(index);
                }
                if (node == null) {
        bin.releaseLatch();
        return null;
    }
                if (node.containsDuplicates()) {
                    /* It's a duplicate tree. */
                    duplicateRoot = (DIN) node;
                    duplicateRoot.latch();
                    bin.releaseLatch();
                    duplicateBin = (DBIN) tree.searchSubTree
                        (duplicateRoot, dupKey, SearchType.NORMAL, -1, null,
                         false /*updateGeneration*/);

                    return duplicateBin;
                } else {
                    /* We haven't migrated to a duplicate tree yet.
                     * XXX, isn't this taken care of above? */
                    return bin;
                }
            } else {
                bin.releaseLatch();
                return null;
            }
        } catch (DatabaseException DBE) {
            if (bin != null) {
                bin.releaseLatchIfOwner();
            }
            if (duplicateRoot != null) {
                duplicateRoot.releaseLatchIfOwner();
            }

View Full Code Here

Examples of com.sleepycat.je.tree.BIN

        }

        assert in.isLatchOwner();
       
        /* BIN is latched. */
        BIN bin = (BIN) in;
        int nCursors = bin.nCursors();
        if (nCursors > 0) {
            /* Cursor prohibit compression. */
            return;
        } else {
            BINReference binRef =
                removeCompressibleBinReference(bin.getNodeId());
            if ((binRef == null) || (!binRef.deletedKeysExist())) {
                return;
            } else {

                boolean requeued = bin.compress(binRef, false /* canFetch */);
                lazyProcessed++;

                /*
                 * If this wasn't requeued, but there were deleted keys
                 * remaining, requeue, so the daemon can handle this.  Either
                 * we must have shuffled some items because of a split, or a
                 * child was not resident and we couldn't process that entry.
                 */
                if (!requeued && binRef.deletedKeysExist()) {
                    addBinRefToQueue(binRef, false);
                    lazySplit++;
                } else {
                    if (bin.getNEntries() == 0) {
                        addBinRefToQueue(binRef, false);
                        lazyEmpty++;
                    }
                }
            }
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

         * We need at least 2 BINs, otherwise empty BINs won't be deleted.  So
         * we add keys until the BIN splits, then delete everything in the
         * first BIN except the first two keys.  Those are the keys we'll use
         * for testing, and are key values 0 and 1.
         */
        BIN firstBin = null;
        OperationStatus status;
        for (int i = 0;; i += 1) {
            DatabaseEntry key = new DatabaseEntry(new byte[] { (byte) i });
            status = db.put(null, key, entry0);
            assertEquals(OperationStatus.SUCCESS, status);
            Cursor cursor = db.openCursor(null, null);
            status = cursor.getLast(keyFound, dataFound, null);
            assertEquals(OperationStatus.SUCCESS, status);
            BIN b = DbInternal.getCursorImpl(cursor).getBIN();
            cursor.close();
            if (firstBin == null) {
                firstBin = b;
            } else if (firstBin != b) {
                /* Now delete all but the first two keys in the first BIN. */
 
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

     * non-provisionally.  Used to simulate a partial checkpoint or eviction.
     */
    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;
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

     */
    public static BIN getBIN(Cursor cursor)
        throws DatabaseException {

        CursorImpl impl = DbTestProxy.dbcGetCursorImpl(cursor);
        BIN bin = impl.getDupBIN();
        if (bin == null) {
            bin = impl.getBIN();
            assert bin != null;
        }
        return bin;
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

  TestUtils.checkLatchCount();
  Node n = tree.search(key, Tree.SearchType.NORMAL, -1, null, true);
  if (!(n instanceof BIN)) {
      fail("search didn't return a BIN for key: " + key);
  }
  BIN bin = (BIN) n;
  try {
      int index = bin.findEntry(key, false, true);
      if (index == -1) {
    return false;
      }
      return true;
  } finally {
      bin.releaseLatch();
      TestUtils.checkLatchCount();
  }
    }
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

        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.
         */
 
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

     * @param key on return contains the key if available, or null.
     * @param data on return contains the data if available, or null.
     */
    public boolean advanceCursor(DatabaseEntry key, DatabaseEntry data) {

        BIN oldBin = bin;
        BIN oldDupBin = dupBin;
        int oldIndex = index;
        int oldDupIndex = dupIndex;

        key.setData(null);
        data.setData(null);
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

    public BIN latchBIN()
        throws DatabaseException {

  while (bin != null) {
      BIN waitingOn = bin;
      waitingOn.latch();
      if (bin == waitingOn) {
    return bin;
      }
      waitingOn.releaseLatch();
  }

  return null;
    }
View Full Code Here

Examples of com.sleepycat.je.tree.BIN

    public DBIN latchDBIN()
        throws DatabaseException {

  while (dupBin != null) {
      BIN waitingOn = dupBin;
      waitingOn.latch();
      if (dupBin == waitingOn) {
    return dupBin;
      }
      waitingOn.releaseLatch();
  }
  return 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.