Package com.sleepycat.je.log.entry

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


                if (!isLatchOwnerForWrite()) {
                    throw RelatchRequiredException.relatchRequiredException;
                }

                try {
                    LogEntry logEntry =
                        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;
                } catch (FileNotFoundException e) {
                    if (!isEntryKnownDeleted(idx) &&
View Full Code Here


        sb.append("\" ");
        currentEntryHeader.dumpLogNoTag(sb, verbose);
        sb.append("\">");

        /* Read the entry and dump it into a string buffer. */
        LogEntry entry = lastEntryType.getSharedLogEntry();
        entry.readEntry(envImpl, currentEntryHeader, entryBuffer);
        boolean dumpIt = true;
        if (targetTxnIds.size() > 0) {
            if (lastEntryType.isTransactional()) {
                if (!targetTxnIds.contains
                    (Long.valueOf(entry.getTransactionId()))) {
                    /* Not in the list of txn ids. */
                    dumpIt = false;
                }
            } else {
                /* If -tx spec'd and not a transactional entry, don't dump. */
                dumpIt = false;
            }
        }

        if (dumpIt) {
            entry.dumpEntry(sb, verbose);
            sb.append("</entry>");
            System.out.println(sb.toString());
        }

        return true;
View Full Code Here

    protected boolean processEntry(ByteBuffer entryBuffer)
        throws DatabaseException {

        final LogEntryType lastEntryType =
            LogEntryType.findType(currentEntryHeader.getType());
        final LogEntry entry = lastEntryType.getNewLogEntry();
        entry.readEntry(envImpl, currentEntryHeader, entryBuffer);

        ExtendedFileSummary summary =
                (ExtendedFileSummary) summaries.get(window.currentFileNum());
        if (summary == null) {
            summary = new ExtendedFileSummary();
            summaries.put(window.currentFileNum(), summary);
        }

        final int size = getLastEntrySize();

        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);
                }
                txnEntries.add(summary);
                txnEntries.add(lnEntry);
            } else {
                twoEntryList.set(0, summary);
                twoEntryList.set(1, lnEntry);
                applyTxn(twoEntryList, true);
            }
        } else if (entry instanceof INLogEntry) {

            /* Count IN. */
            final INLogEntry inEntry = (INLogEntry) entry;
            final Long nodeId = Long.valueOf(inEntry.getNodeId());
            summary.totalINCount += 1;
            summary.totalINSize += size;
            countObsoleteIN(nodeId);
            putActiveIN(nodeId, size, summary, inEntry.getDbId().getId());

        } else if (entry instanceof BINDeltaLogEntry) {

            /* Count Delta as IN. */
            summary.totalINCount += 1;
            summary.totalINSize += size;

        } else if (entry instanceof SingleItemEntry) {

            /* Count deleted IN. */
            final Object item = ((SingleItemEntry) entry).getMainItem();
            final long deletedNodeId;
            if (item instanceof INDeleteInfo) {
                deletedNodeId = ((INDeleteInfo) item).getDeletedNodeId();
            } else if (item instanceof INDupDeleteInfo) {
                deletedNodeId = ((INDupDeleteInfo) item).getDeletedNodeId();
            } else {
                deletedNodeId = Node.NULL_NODE_ID;
            }
            if (deletedNodeId != Node.NULL_NODE_ID) {
                final Long nodeId = deletedNodeId;
                countObsoleteIN(nodeId);
                activeINs.remove(nodeId);
            }

            /* Apply transaction on commit or abort. */
            if (item instanceof TxnEnd) {
                final Long txnId = Long.valueOf(entry.getTransactionId());
                final List<Object> txnEntries = txns.remove(txnId);
                if (txnEntries != null) {
                    applyTxn(txnEntries, item instanceof TxnCommit);
                }
            }
View Full Code Here

    protected boolean processEntry(ByteBuffer entryBuffer)
        throws DatabaseException {

        LogEntryType lastEntryType =
            LogEntryType.findType(currentEntryHeader.getType());
        LogEntry entry = lastEntryType.getSharedLogEntry();
        entry.readEntry(envImpl, currentEntryHeader, entryBuffer);
        processEntryCallback(entry, lastEntryType);
        return true;
    }
View Full Code Here

        assertEquals(foundType, LogEntryType.LOG_IN);
        assertTrue(foundType.getSharedLogEntry() instanceof
                   com.sleepycat.je.log.entry.INLogEntry);

        /* Get a new entry object */
        LogEntry sharedEntry = foundType.getSharedLogEntry();
        LogEntry newEntry = foundType.getNewLogEntry();
       
        assertTrue(sharedEntry != newEntry);
    }
View Full Code Here

            sb.append("\" cksum=\"").append(currentEntryChecksum);
        }
        sb.append("\">");

        /* Read the entry and dump it into a string buffer. */
  LogEntry entry = lastEntryType.getSharedLogEntry();
        entry.readEntry(entryBuffer, currentEntrySize,
                        currentEntryTypeVersion, true);
  boolean dumpIt = true;
  if (targetTxnIds.size() > 0) {
      if (entry.isTransactional()) {
    if (!targetTxnIds.contains
        (new Long(entry.getTransactionId()))) {
        /* Not in the list of txn ids. */
        dumpIt = false;
    }
      } else {
    /* If -tx spec'd and not a transactional entry, don't dump. */
    dumpIt = false;
      }
  }

  if (dumpIt) {
      entry.dumpEntry(sb, verbose);
      sb.append("</entry>");
      System.out.println(sb.toString());
  }
       
        return true;
View Full Code Here

        fsTrackingEntry = null;
        isProvisional = LogEntryType.isProvisional(entryTypeVersion);

        /* Get the log entry type instance we need to read the entry. */
        fromLogType = LogEntryType.findType(entryTypeNum, entryTypeVersion);
        LogEntry possibleTarget = (LogEntry) targetEntryMap.get(fromLogType);

        /*
         * If the entry is provisional, we won't be reading it in its entirety;
         * otherwise, we try to establish targetLogEntry.
         */
 
View Full Code Here

        throws DatabaseException {

        LogEntryType lastEntryType =
            LogEntryType.findType(currentEntryTypeNum,
          currentEntryTypeVersion);
  LogEntry entry = lastEntryType.getSharedLogEntry();
        entry.readEntry(entryBuffer, currentEntrySize,
                        currentEntryTypeVersion, true);
  processEntryCallback(entry, lastEntryType);
        return true;
    }
View Full Code Here

        /*
         * Read the file header from this file. It's always the first log
         * entry.
         */
        LogManager logManager = envImpl.getLogManager();
        LogEntry headerEntry =
            logManager.getLogEntry(DbLsn.makeLsn(fileNum, 0), file);
        FileHeader header = (FileHeader) headerEntry.getMainItem();
        return header.validate(fileName, fileNum);
    }
View Full Code Here

     * @return the prevOffset field stored in the file header.
     */
    long getFileHeaderPrevOffset(long fileNum)
        throws IOException, DatabaseException {
       
        LogEntry headerEntry =
            envImpl.getLogManager().getLogEntry(DbLsn.makeLsn(fileNum, 0));
        FileHeader header = (FileHeader) headerEntry.getMainItem();
        return header.getLastEntryInPrevFileOffset();
    }
View Full Code Here

TOP

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

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.