Examples of LNLogEntry


Examples of com.sleepycat.je.log.entry.LNLogEntry

  boolean processThisEntry =
      checkProcessEntry(entry, entryType, false);

  if (processThisEntry &&
      (entry instanceof LNLogEntry)) {
      LNLogEntry lnEntry = (LNLogEntry) entry;
      LN ln = lnEntry.getLN();
      if (ln instanceof NameLN) {
    String name = new String(lnEntry.getKey());
    Integer dbId = new Integer(((NameLN) ln).getId().getId());
    if (dbIdToName.containsKey(dbId) &&
        !((String) dbIdToName.get(dbId)).equals(name)) {
        throw new DatabaseException
      ("Already name mapped for dbId: " + dbId +
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

  boolean processThisEntry =
      checkProcessEntry(entry, entryType, true);
       
  if (processThisEntry) {
      LNLogEntry lnEntry = (LNLogEntry) entry;
      Integer dbId = new Integer(lnEntry.getDbId().getId());
      PrintStream out = getOutputStream(dbId);
          
            LN ln = lnEntry.getLN();
            byte[] keyData = lnEntry.getKey();
            byte[] data = ln.getData();
            if (data != null) {
                dumpOne(out, keyData, formatUsingPrintable);
                dumpOne(out, data, formatUsingPrintable);
    if ((++flushCounter % FLUSH_INTERVAL) == 0) {
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

             * Note that these entries do not overlap with targetLogEntry.
             *
             * XXX We're doing a full load for now, since LNLogEntry does not
             * read the db and txn id in a partial load, only the node id.
             */
            LNLogEntry lnEntry = null;
            if (dbIdTrackingEntry != null) {
                /* This entry has a db id */
    lnEntry = dbIdTrackingEntry;
    lnEntry.readEntry(entryBuffer, currentEntrySize,
          currentEntryTypeVersion,
          true /* full load */);
    entryLoaded = true;
                MapLN mapLN = (MapLN) lnEntry.getMainItem();
                int dbId = mapLN.getDatabase().getId().getId();
                if (dbId > maxDbId) {
                    maxDbId = dbId;
                }
            }
            if (txnIdTrackingEntry != null) {
                /* This entry has a txn id */
                if (lnEntry == null) {
                    lnEntry = txnIdTrackingEntry;
                    lnEntry.readEntry(entryBuffer, currentEntrySize,
                                      currentEntryTypeVersion,
                                      true /* full load */);
                    entryLoaded = true;
                }
                long txnId = lnEntry.getTxnId().longValue();
                if (txnId > maxTxnId) {
                    maxTxnId = txnId;
                }
            }

View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

        /* Read the whole entry out of the log. */
        Object o = env.getLogManager().getLogEntry(lsn);
        if (!(o instanceof LNLogEntry)) {
            return true;
        }
        LNLogEntry entry = (LNLogEntry)o;

        /* All deleted LNs are obsolete. */
        if (entry.getLN().isDeleted()) {
            return true;
        }
       
        /* Find the owning database. */
        DatabaseId dbId = entry.getDbId();
        DatabaseImpl db = env.getDbMapTree().getDb(dbId);

        /*
         * The whole database is gone, so this LN is obsolete. No need
         * to worry about delete cleanup; this is just verification and
         * no cleaning is done.
         */
        if (db == null || db.isDeleted()) {
            return true;
        }

        /*
         * Search down to the bottom most level for the parent of this LN.
         */
        BIN bin = null;
        try {
            Tree tree = db.getTree();
            TreeLocation location = new TreeLocation();
            boolean parentFound = tree.getParentBINForChildLN
                (location,
                 entry.getKey(),
                 entry.getDupKey(),
                 entry.getLN(),
                 false,  // splitsAllowed
                 true,   // findDeletedEntries
                 false,  // searchDupTree ???
                 false); // updateGeneration
            bin = location.bin;
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

        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();
            }
        } catch (RuntimeException e) {
            throw new DatabaseException("Txn undo for node=" + nodeId +
                                        " LSN=" +
                                        DbLsn.getNoFormatString(undoLsn), e);
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

        /* Don't count abortLsn as obsolete, this is done during commit. */
        if (oldLsn == logAbortLsn) {
            oldLsn = DbLsn.NULL_LSN;
        }

        LNLogEntry logEntry = new LNLogEntry(entryType,
                                             this,
                                             dbId,
                                             key,
                                             logAbortLsn,
               logAbortKnownDeleted,
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

        /*
         * Check the nodeid to see if we've already seen it or not.
         */
        if (entry instanceof LNLogEntry) {
            LNLogEntry lnEntry = (LNLogEntry) entry;
            LN ln = lnEntry.getLN();
            long nodeId = ln.getNodeId();

            /*
             * If aggressive, don't worry about whether this node has been
             * dumped already.
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

        boolean processThisEntry =
            checkProcessEntry(entry, entryType, false);

        if (processThisEntry &&
            (entry instanceof LNLogEntry)) {
            LNLogEntry lnEntry = (LNLogEntry) entry;
            LN ln = lnEntry.getLN();
            if (ln instanceof NameLN) {
                String name = new String(lnEntry.getKey());
                Integer dbId = Integer.valueOf(((NameLN) ln).getId().getId());
                if (dbIdToName.containsKey(dbId) &&
                    !dbIdToName.get(dbId).equals(name)) {
                    throw EnvironmentFailureException.unexpectedState
                        ("Already name mapped for dbId: " + dbId +
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

        boolean processThisEntry =
            checkProcessEntry(entry, entryType, true);

        if (processThisEntry) {
            LNLogEntry lnEntry = (LNLogEntry) entry;
            Integer dbId = Integer.valueOf(lnEntry.getDbId().getId());
            LN ln = lnEntry.getLN();

            /* Create output file even if we don't process a deleted entry. */
            PrintStream out = getOutputStream(dbId);

            if (!ln.isDeleted()) {
                byte[] keyData = lnEntry.getKey();
                byte[] data = ln.getData();
                dumpOne(out, keyData, formatUsingPrintable);
                dumpOne(out, data, formatUsingPrintable);
                if ((++flushCounter % FLUSH_INTERVAL) == 0) {
                    out.flush();
View Full Code Here

Examples of com.sleepycat.je.log.entry.LNLogEntry

    private void applyLN(final ReplayTxn repTxn,
                         final InputWireRecord wireRecord)
        throws DatabaseException {

        final LNLogEntry lnEntry = (LNLogEntry) wireRecord.getLogEntry();
        final DatabaseId dbId = lnEntry.getDbId();

        /*
         * If this is a change to the rep group db, remember at commit time,
         * and refresh this node's group metadata.
         */
        if (dbId.getId() == RepGroupDB.DB_ID) {
            repTxn.noteRepGroupDbChange();
        }

        /*
         * Note that we don't have to worry about serializable isolation when
         * applying a replicated txn; serializable isolation in only an issue
         * for txns that take read locks, and a replicated txn consists only of
         * write operations.
         */
        final DatabaseImpl dbImpl = repImpl.getDbTree().getDb
            (dbId, -1, repImpl.getRepNode().getReplica().getDbCache());
        final ReplicationContext repContext =
            new ReplicationContext(wireRecord.getVLSN());
        final Cursor cursor = DbInternal.makeCursor(dbImpl, repTxn,
                                                    null /*cursorConfig*/);
        try {
            OperationStatus status;
            final LN ln = lnEntry.getLN();

            if (ln.isDeleted()) {
                /* Perform an exact search by key or key/data. */
                final DatabaseEntry key = new DatabaseEntry(lnEntry.getKey());
                final byte[] dupKey = lnEntry.getDupKey();
                final DatabaseEntry data = new DatabaseEntry();
                final SearchMode searchMode;
                if (dupKey == null) {
                    searchMode = SearchMode.SET;
                } else {
                    searchMode = SearchMode.BOTH;
                    data.setData(dupKey);
                }
                status = DbInternal.search(cursor, key, data, LockMode.RMW,
                                           searchMode);
                if (status == OperationStatus.SUCCESS) {
                    status = DbInternal.deleteInternal(cursor, repContext);
                }
            } else {
                status = DbInternal.putLN(cursor, lnEntry.getKey(), ln,
                                          PutMode.OVERWRITE_KNOWN, repContext);
            }

            if (status != OperationStatus.SUCCESS) {
                throw new EnvironmentFailureException
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.