Package com.sleepycat.je.log.entry

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.getRepNode().getReplica().getDbCache().get(dbId, repTxn);
        lnEntry.postFetchInit(dbImpl);
        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.  Use read-uncommitted and
                 * partial data entry to avoid reading old data.
                 */
                final DatabaseEntry key = new DatabaseEntry(lnEntry.getKey());
                final DatabaseEntry data = new DatabaseEntry();
                data.setPartial(0, 0, true);
                status = DbInternal.searchForReplay(cursor, key, data,
                                                    LockMode.READ_UNCOMMITTED,
                                                    SearchMode.SET);
                if (status == OperationStatus.SUCCESS) {
                    status = DbInternal.deleteInternal(cursor, repContext);
                }
            } else {
                status = DbInternal.putForReplay(cursor, lnEntry.getKey(), ln,
                                                 PutMode.OVERWRITE,
                                                 repContext);
            }

            if (status != OperationStatus.SUCCESS) {
View Full Code Here


        DatabaseImpl db = dbMapTree.getDb(dbId);
        /* Database may be null if it's been deleted. */
        if (db == null) {
            return;
        }
        LNLogEntry lnEntry = reader.getLNLogEntry();
        lnEntry.postFetchInit(db);
        LN ln = lnEntry.getLN();
        TreeLocation location = new TreeLocation();
        long logLsn = reader.getLastLsn();
        long abortLsn = reader.getAbortLsn();
        boolean abortKnownDeleted = reader.getAbortKnownDeleted();

        try {

            ln.postFetchInit(db, logLsn);
            recoveryUndo(db, location, ln, lnEntry.getKey(), logLsn, abortLsn,
                         abortKnownDeleted);

            /* Undo utilization info. */
            undoUtilizationInfo(ln, db, logLsn, reader.getLastEntrySize());

View Full Code Here

                if (db == null) {
                    counter.incNumDeleted();
                    continue;
                }
                try {
                    LNLogEntry lnEntry = reader.getLNLogEntry();
                    lnEntry.postFetchInit(db);
                    LN ln = lnEntry.getLN();

                    long logLsn = reader.getLastLsn();
                    long treeLsn = DbLsn.NULL_LSN;

                    counter.incNumProcessed();
                    treeLsn = redoOneLN(reader, ln, lnEntry.getKey(), logLsn,
                                        dbId, db, eligible, location);

                    /*
                     * Redo utilization info irregardless of whether the db
                     * is deleted or not.
View Full Code Here

        }

        if (entry instanceof LNLogEntry) {
            if (LogEntryType.LOG_NAMELN_TRANSACTIONAL.equalsType
                (getEntryType())) {
                LNLogEntry lnEntry = (LNLogEntry) entry;
                lnEntry.postFetchInit(false /*isDupDb*/);
                NameLN nameLN = (NameLN) lnEntry.getLN();
                if (nameLN.getId().getId() >= 0) {
                    throw EnvironmentFailureException.unexpectedState
                        (debugTag + " db id should be negative: " + entry);
                }
            } else {
View Full Code Here

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

        /* All deleted LNs are obsolete. */
        if (entry.isDeleted()) {
            return true;
        }

        /* Find the owning database. */
        DatabaseId dbId = entry.getDbId();
        DatabaseImpl db = env.getDbTree().getDb(dbId);

        /*
         * Search down to the bottom most level for the parent of this LN.
         */
        BIN bin = null;
        try {
            /*
             * 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;
            }

            entry.postFetchInit(db);

            Tree tree = db.getTree();
            TreeLocation location = new TreeLocation();
            boolean parentFound = tree.getParentBINForChildLN
                (location, entry.getKey(), false /*splitsAllowed*/,
                 true /*findDeletedEntries*/, CacheMode.UNCHANGED);
            bin = location.bin;
            int index = location.index;

            /* Is bin latched ? */
 
View Full Code Here

                }

                /* The entry is not known to be obsolete -- process it now. */
                if (isLN) {

                    final LNLogEntry lnEntry = reader.getLNLogEntry();
                    lnEntry.postFetchInit(db);
                    final LN targetLN = lnEntry.getLN();
                    final byte[] key = lnEntry.getKey();

                    lookAheadCache.add
                        (Long.valueOf(DbLsn.getFileOffset(logLsn)),
                         new LNInfo(targetLN, dbId, key));

View Full Code Here

                        envImpl.getLogManager().
                        getLogEntryAllowInvisibleAtRecovery(lsn);
                    /* Ensure keys are transactionally correct. [#15704] */
                    byte[] lnSlotKey = null;
                    if (logEntry instanceof LNLogEntry) {
                        LNLogEntry lnEntry = (LNLogEntry) logEntry;
                        lnEntry.postFetchInit(databaseImpl);
                        lnSlotKey = lnEntry.getKey();
                    }
                    Node node = (Node) logEntry.getResolvedItem(databaseImpl);
                    node.postFetchInit(databaseImpl, lsn);
                    updateNode(idx, node, lnSlotKey);
                    isMiss = true;
View Full Code Here

        summary.totalCount += 1;
        summary.totalSize += size;

        if (entry instanceof LNLogEntry) {
            final LNLogEntry lnEntry = (LNLogEntry) entry;
            if (DEBUG) {
                final int otherSize = lnEntry.getLastLoggedSize();
                if (size != otherSize) {
                    System.out.println
                        ("LogReader.getLastEntrySize=" + size +
                         " LNEntry.getLastLoggedSize=" + otherSize +
                         " " + lnEntry.getLogType());
                }
            }

            /* Save transactional entry, apply non-transactional entry. */
            if (lastEntryType.isTransactional()) {
                final Long txnId = Long.valueOf(lnEntry.getTransactionId());
                List<Object> txnEntries = txns.get(txnId);
                if (txnEntries == null) {
                    txnEntries = new ArrayList<Object>();
                    txns.put(txnId, txnEntries);
                }
View Full Code Here

    private void applyTxn(List<Object> entries, boolean commit) {
        for (int i = 0; i < entries.size(); i += 2) {
            final ExtendedFileSummary summary =
                (ExtendedFileSummary) entries.get(i);
            final LNLogEntry lnEntry = (LNLogEntry) entries.get(i + 1);
            final DatabaseId dbId = lnEntry.getDbId();
            final DatabaseImpl dbImpl =
                dbTree.getDb(dbId, -1 /*timeout*/, dbCache);
            final int size = lnEntry.getLastLoggedSize();

            summary.totalLNCount += 1;
            summary.totalLNSize += size;

            if (!commit ||
                lnEntry.isDeleted() ||
                dbImpl == null ||
                dbImpl.isDeleteFinished()) {

                /* Count immediately obsolete LN. */
                summary.obsoleteLNCount += 1;
                summary.recalcObsoleteLNSize += size;
            }
            if (commit && dbImpl != null) {
                /* Count committed LN. */
                lnEntry.postFetchInit(dbImpl);
                final CompareSlot slot = new CompareSlot(dbImpl, lnEntry);
                countObsoleteLN(slot);
                if (dbImpl.isDeleteFinished() || lnEntry.isDeleted()) {
                    activeLNs.remove(slot);
                } else {
                    putActiveLN(slot, size, summary,
                                lnEntry.getDbId().getId());
                }
            }
        }
    }
View Full Code Here

                              long logAbortLsn,
                              boolean logAbortKnownDeleted,
                              Txn logTxn,
                              ReplicationContext repContext) {

        return new LNLogEntry(entryType,
                              this,
                              dbImpl.getId(),
                              key,
                              logAbortLsn,
                              logAbortKnownDeleted,
View Full Code Here

TOP

Related Classes of com.sleepycat.je.log.entry.LNLogEntry

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.