Package com.sleepycat.je.log.entry

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


            }
        }

        if (lastEntryType.isUserLNType()) {
            /* Read the entry into the ByteBuffer. */
            LNLogEntry entry = (LNLogEntry) lastEntryType.getSharedLogEntry();
            entry.readEntry(envImpl, currentEntryHeader, entryBuffer);

            /*
             * The getUnconvertedXxx methods are used because we don't have a
             * DatabaseImpl for calling LNLogEntry.postFetchInit, and we can
             * tolerate statistics that use the old duplicates format.
             */
            int keyLen = entry.getUnconvertedKeyLength();
            realTotalKeyBytes += keyLen;
            if (!entry.isDeleted()) {
                int dataLen = entry.getUnconvertedDataLength();
                realTotalDataBytes += dataLen;
            }
        }

        entryBuffer.position(nextEntryPosition);
View Full Code Here


        try {
            lastValidVLSN = VLSN.NULL_VLSN;
            while (undoLsn != DbLsn.NULL_LSN) {
                WholeEntry wholeEntry =
                    logManager.getLogEntryAllowInvisible(undoLsn);
                LNLogEntry undoEntry = (LNLogEntry) wholeEntry.getEntry();

                DatabaseImpl dbImpl = getDatabaseImpl(undoEntry.getDbId());
                undoEntry.postFetchInit(dbImpl);

                try {

                    /*
                     * Add the LSN of the entry we're now perusing to the
                     * keyToLsns map.
                     */
                    CompareSlot entrySlot = new CompareSlot(dbImpl, undoEntry);
                    LinkedList<Long> lsns = keyToLsns.get(entrySlot);

                    if (lsns == null) {
                        lsns = new LinkedList<Long>();
                        keyToLsns.put(entrySlot, lsns);
                    }
                    lsns.add(undoLsn);

                    /*
                     * If this is an entry that will be rolled back, save
                     * enough information to calculate the prev version.
                     */
                    if (DbLsn.compareTo(undoLsn, matchpoint) > 0) {
                        chain.add(new VersionCalculator
                                  (undoLsn,
                                   undoEntry.getAbortLsn(),
                                   undoEntry.getAbortKnownDeleted(),
                                   lsns));
                    } else {
                        remainingLockedNodes.add(undoLsn);
                        if (lastValidVLSN != null &&
                            lastValidVLSN.isNull() &&
                            wholeEntry.getHeader().getVLSN() != null &&
                            !wholeEntry.getHeader().getVLSN().isNull()) {
                            lastValidVLSN = wholeEntry.getHeader().getVLSN();
                        }
                    }

                    /* Move on to the previous log entry for this txn. */
                    undoLsn = undoEntry.getUserTxn().getLastLsn();
                } finally {
                    releaseDatabaseImpl(dbImpl);
                }
            }
        } catch (FileNotFoundException e) {
View Full Code Here

        /*
         * Check the nodeId to see if we've already seen it or not.
         */
        if (entry instanceof LNLogEntry) {

            final LNLogEntry lnEntry = (LNLogEntry) entry;
            final long dbId = lnEntry.getDbId().getId();
            final DatabaseImpl db = dbIdToImpl.get(dbId);
            /* Must call postFetchInit if true is returned. */
            if (db != null) {
                lnEntry.postFetchInit(db);
            } else {
                lnEntry.postFetchInit(false /*isDupDb*/);
            }

            /*
             * If aggressive or if processing DbTree entries, don't worry about
             * whether this node has been processed already.
View Full Code Here

        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());
                Long dbId = Long.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

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

        if (processThisEntry) {
            LNLogEntry lnEntry = (LNLogEntry) entry;
            Long dbId = Long.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()) {
                DatabaseEntry key = new DatabaseEntry();
                DatabaseEntry data = new DatabaseEntry();
                lnEntry.getUserKeyData(key, data);
                dumpOne(out, key.getData(), formatUsingPrintable);
                dumpOne(out, data.getData(), formatUsingPrintable);
                if ((++flushCounter % FLUSH_INTERVAL) == 0) {
                    out.flush();
                    flushCounter = 0;
View Full Code Here

    private static class UserLNLogEntryType extends LogEntryType {
        public UserLNLogEntryType(byte typeNum,
                                  String displayName,
                                  Txnal txnal) {
            super(typeNum, displayName,
                  new LNLogEntry(com.sleepycat.je.tree.LN.class),
                  txnal, Marshall.OUTSIDE_LATCH,
                  Replicable.REPLICABLE_NO_MATCH, NodeType.LN_USER);
        }
View Full Code Here

            /* For an LNLogEntry, call postFetchInit and get the lnKey. */
            DatabaseImpl dbImpl = in.getDatabase();
            byte[] lnKey = null;
            if (entry instanceof LNLogEntry) {
                LNLogEntry lnEntry = (LNLogEntry) entry;
                lnEntry.postFetchInit(dbImpl);
                lnKey = lnEntry.getKey();
                lnKeyEntry.setData(lnKey);
            }

            /* Get the Node from the LogEntry. */
            Node ret = (Node) entry.getResolvedItem(dbImpl);
View Full Code Here

        DatabaseId dbIdToReset = null;
        long fileNumToReset = -1;

        /* Process LN types. */
        if (fromLogType.isLNType()) {
            LNLogEntry lnEntry = (LNLogEntry) targetLogEntry;

            if (fromLogType.equals(LogEntryType.LOG_MAPLN) ||
                fromLogType.equals(LogEntryType.LOG_MAPLN_TRANSACTIONAL)) {
                MapLN mapLN = (MapLN) lnEntry.getMainItem();
                DatabaseId dbId = mapLN.getDatabase().getId();

                /* Track latest DB ID. */
                long dbIdVal = dbId.getId();
                maxDbId = (dbIdVal > maxDbId) ? dbIdVal : maxDbId;
                minReplicatedDbId = (dbIdVal < minReplicatedDbId) ?
                    dbIdVal : minReplicatedDbId;

                /*
                 * When a MapLN is encountered, reset the tracked information
                 * for that database.  This clears what we accummulated
                 * previously for the database during this recovery pass.
                 */
                dbIdToReset = dbId;

                /* Save the LSN of the MapLN for use by undo/redo. */
                tracker.saveLastLoggedMapLN(dbId, getLastLsn());
            }

            /* Track latest txn ID. */
            if (fromLogType.isTransactional()) {
                long txnId = lnEntry.getTxnId().longValue();
                maxTxnId = (txnId > maxTxnId) ? txnId : maxTxnId;
                minReplicatedTxnId = (txnId < minReplicatedTxnId) ?
                    txnId : minReplicatedTxnId;
            }

            /*
             * When a FileSummaryLN is encountered, reset the tracked summary
             * for that file.  This clears what we accummulated previously for
             * the file during this recovery pass.
             */
            if (LogEntryType.LOG_FILESUMMARYLN.equals(fromLogType)) {
                lnEntry.postFetchInit(false /*isDupDb*/);
                byte[] keyBytes = lnEntry.getKey();
                FileSummaryLN fsln = (FileSummaryLN) lnEntry.getMainItem();
                long fileNum = fsln.getFileNumber(keyBytes);
                fileNumToReset = fileNum;

                /* Save the LSN of the FileSummaryLN for use by undo/redo. */
                tracker.saveLastLoggedFileSummaryLN(fileNum, getLastLsn());
View Full Code Here

             * and data, not the raw key and data, because we're replaying the
             * user-level operation.  Duplicate DBs have two-part keys
             * containing the key and data, and LNLogEntry.getUserKeyData is
             * used to convert this back to the user operation params.
             */
            LNLogEntry lnEntry = reader.getLNLogEntry();
            lnEntry.postFetchInit(dbInfo.duplicates);
            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry data = (lnEntry.getLN().getData() != null) ?
                (new DatabaseEntry()) :
                null;
            lnEntry.getUserKeyData(key, data);

            /* Make sure the entry type is valid. */
            LogEntryType entryType =
                LogEntryType.findType(reader.getLogEntryType());
            assert entryType.isUserLNType() && entryType.isTransactional();
View Full Code Here

     * this logical node.
     */
    private boolean firstInstance(Set<Long> seenLsns,
                                  Set<CompareSlot> seenSlots,
                                  UndoReader undo) {
        final LNLogEntry undoEntry = undo.logEntry;
        final long abortLsn = undoEntry.getAbortLsn();
        if (abortLsn != DbLsn.NULL_LSN) {
            return seenLsns.add(abortLsn);
        }
        final CompareSlot slot = new CompareSlot(undo.db, undoEntry);
        return seenSlots.add(slot);
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.