Package com.sleepycat.je.log

Examples of com.sleepycat.je.log.LogManager


        /*
         * Create a new root IN, insert the current root IN into it, and then
         * call split.
         */
        EnvironmentImpl env = database.getDbEnvironment();
        LogManager logManager = env.getLogManager();
        INList inMemoryINs = env.getInMemoryINs();

        IN curRoot = null;
        curRoot = (IN) root.fetchTarget(database, null);
        curRoot.latch();
View Full Code Here


                /* Continue down a level */
                parent = child;
            } while (!(parent instanceof BIN));

            boolean startedSplits = false;
            LogManager logManager =
                database.getDbEnvironment().getLogManager();

            /*
             * Process the accumulated nodes from the bottom up. Split each
             * node if required. If the node should not split, we check if
View Full Code Here

        throws DatabaseException {

        validateInsertArgs(allowDuplicates);

        EnvironmentImpl env = database.getDbEnvironment();
        LogManager logManager = env.getLogManager();
        INList inMemoryINs = env.getInMemoryINs();

        /* Find and latch the relevant BIN. */
        BIN bin = null;
        try {
View Full Code Here

        DIN curRoot = (DIN) bin.fetchTarget(index);

        if (curRoot.needsSplitting()) {

            EnvironmentImpl env = database.getDbEnvironment();
            LogManager logManager = env.getLogManager();
            INList inMemoryINs = env.getInMemoryINs();

            /*
             * Make a new root DIN, giving it an id key from the previous root.
             */
 
View Full Code Here

         " prepare failed because there were open cursors.");
      }

      TxnPrepare prepareRecord =
    new TxnPrepare(id, xid); /* Flush required. */
      LogManager logManager = envImpl.getLogManager();
      logManager.logForceFlush(prepareRecord, true); // sync required
  }
  setPrepared(true);
  return XAResource.XA_OK;
    }
View Full Code Here

                        transferHandleLockToHandleSet((Long) entry.getKey(),
                                                      (Set) entry.getValue());
                    }
                }

                LogManager logManager = envImpl.getLogManager();

                /*
                 * Release all read locks, clear lock collection. Optimize for
                 * the case where there are no read locks.
                 */
                int numReadLocks = clearReadLocks();

                /*
                 * Log the commit if we ever held any write locks. Note that
                 * with dbhandle write locks, we may have held the write lock
                 * but then had it transferred away.
                 */
                int numWriteLocks = 0;
                if (writeInfo != null) {
                    numWriteLocks = writeInfo.size();
                    TxnCommit commitRecord =
                        new TxnCommit(id, lastLoggedLsn);
        if (flushSyncBehavior == TXN_SYNC) {
      /* Flush and sync required. */
      commitLsn = logManager.
          logForceFlush(commitRecord, true);
        } else if (flushSyncBehavior == TXN_WRITE_NOSYNC) {
      /* Flush but no sync required. */
      commitLsn = logManager.
          logForceFlush(commitRecord, false);
        } else {
      /* No flush, no sync required. */
      commitLsn = logManager.log(commitRecord);
        }
               
                    /*
                     * Used to prevent double counting abortLNS if there is
                     * more then one node with the same abortLSN in this txn.
                     * Two nodes with the same abortLSN occur when a deleted
                     * slot is reused in the same txn.
                     */
                    Set alreadyCountedLsnSet = new HashSet();

                    /* Release all write locks, clear lock collection. */
                    Iterator iter = writeInfo.values().iterator();
                    while (iter.hasNext()) {
                        WriteLockInfo info = (WriteLockInfo) iter.next();
                        lockManager.release(info.lock, this);

                        /*
                         * Count the abortLSN as obsolete.  Do not count if a
                         * slot with a deleted LN was reused
                         * (abortKnownDeleted), to avoid double counting.
                         */
                        if (info.abortLsn != DbLsn.NULL_LSN &&
                            !info.abortKnownDeleted) {
                            Long longLsn = new Long(info.abortLsn);
                            if (!alreadyCountedLsnSet.contains(longLsn)) {
                                logManager.countObsoleteNode
                                    (info.abortLsn, null);
                                alreadyCountedLsnSet.add(longLsn);
                            }
                        }
                    }
View Full Code Here

    private void undo()
        throws DatabaseException {
       
        Long nodeId = null;
        long undoLsn = lastLoggedLsn;
        LogManager logManager = envImpl.getLogManager();

        try {
            Set alreadyUndone = new HashSet();
            TreeLocation location = new TreeLocation();
            while (undoLsn != DbLsn.NULL_LSN) {

                LNLogEntry undoEntry =
        (LNLogEntry) logManager.getLogEntry(undoLsn);
                LN undoLN = undoEntry.getLN();
                nodeId = new Long(undoLN.getNodeId());

                /*
                 * Only process this if this is the first time we've seen this
                 * node. All log entries for a given node have the same
                 * abortLsn, so we don't need to undo it multiple times.
                 */
                if (!alreadyUndone.contains(nodeId)) {
                    alreadyUndone.add(nodeId);
                    DatabaseId dbId = undoEntry.getDbId();
                    DatabaseImpl db = (DatabaseImpl) undoDatabases.get(dbId);
                    undoLN.postFetchInit(db, undoLsn);
                    long abortLsn = undoEntry.getAbortLsn();
                    boolean abortKnownDeleted =
                        undoEntry.getAbortKnownDeleted();
                    try {
                        RecoveryManager.undo(Level.FINER,
                                             db,
                                             location,
                                             undoLN,
                                             undoEntry.getKey(),
                                             undoEntry.getDupKey(),
                                             undoLsn,
                                             abortLsn,
                                             abortKnownDeleted,
                                             null, false);
                    } finally {
                        if (location.bin != null) {
                            location.bin.releaseLatchIfOwner();
                        }
                    }
           
                    /*
                     * The LN undone is counted as obsolete if it was not
                     * deleted.
                     */
                    if (!undoLN.isDeleted()) {
                        logManager.countObsoleteNode(undoLsn, null);
                    }
                }

                /* Move on to the previous log entry for this txn. */
                undoLsn = undoEntry.getUserTxn().getLastLsn();
View Full Code Here

        throws DatabaseException {

        ListIterator<SplitInfo> iter =
            nodeLadder.listIterator(nodeLadder.size());
        EnvironmentImpl envImpl = database.getDbEnvironment();
        LogManager logManager = envImpl.getLogManager();

        long newLsn = DbLsn.NULL_LSN;
        SplitInfo info = null;
        while (iter.hasPrevious()) {
            info = iter.previous();
View Full Code Here

        /*
         * Create a new root IN, insert the current root IN into it, and then
         * call split.
         */
        EnvironmentImpl env = database.getDbEnvironment();
        LogManager logManager = env.getLogManager();
        INList inMemoryINs = env.getInMemoryINs();

        IN curRoot = null;
        curRoot = (IN) root.fetchTarget(database, null);
        curRoot.latch(cacheMode);
View Full Code Here

                /* Continue down a level */
                parent = child;
            } while (!(parent instanceof BIN));

            boolean startedSplits = false;
            LogManager logManager =
                database.getDbEnvironment().getLogManager();

            /*
             * Process the accumulated nodes from the bottom up. Split each
             * node if required. If the node should not split, we check if
View Full Code Here

TOP

Related Classes of com.sleepycat.je.log.LogManager

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.