Package com.sleepycat.je.utilint

Examples of com.sleepycat.je.utilint.VLSN


                                  NodeType.values()[input.readByte()],
                                  input.readBoolean(),
                                  input.readBoolean(),
                                  input.readString(),
                                  input.readInt(),
                                  new BarrierState(new VLSN(input.readLong()),
                                                  input.readLong()),
                                                  input.readInt());
            return mi;
        }
View Full Code Here


        protected VLSN getVLSN(ByteBuffer buffer) {
            long vlsn = LogUtils.readLong(buffer);
            return (vlsn == VLSN.NULL_VLSN.getSequence()) ?
                 VLSN.NULL_VLSN :
                 new VLSN(vlsn);
        }
View Full Code Here

            /*
             * To avoid hard recovery, only read log entries between the read
             * start and GlobalDurablVLSN for a ReplicatedEnvironment.
             */
            if (envImpl.isReplicated()) {
                VLSN durableVLSN = envImpl.getGroupDurableVLSN();

                /* Read nothing if GlobalCBVLSN is null. */
                if (durableVLSN.isNull()) {
                    return null;
                }

                /*
                 * Read nothing if read start is greater than GroupDurableVLSN.
                 */
                if (durableVLSN.compareTo(new VLSN(readStart)) <= 0) {
                    return null;
                }

                if (firstCreateReader) {
               
                    /*
                     * Find the LSN for readStart (it's a VLSN now) when
                     * LNFileReader is first created.
                     */
                    readStart = envImpl.getLsnForVLSN(new VLSN(readStart),
                                                      readBufferSize);
                    firstCreateReader = false;
                }
       
                /* Find LSN for the durableVLSN. */
 
View Full Code Here

            verifyRollback(range);

            replay.rollback(matchpointVLSN, searchResults.getMatchpointLSN());

            /* Update the vlsnIndex, it will commit synchronously. */
            VLSN startVLSN = matchpointVLSN.getNext();
            vlsnIndex.truncateFromTail(startVLSN,
                                       searchResults.getMatchpointLSN());

            protocol.write(protocol.new StartStream(startVLSN), namedChannel);
            LoggerUtils.info(logger, repImpl,
View Full Code Here

     */
    private void verifyRollback(VLSNRange range)
        throws RollbackException, InsufficientLogException,
        HardRecoveryElectionException, IOException {
        repImpl.setSyncupProgress(SyncupProgress.CHECK_FOR_ROLLBACK);
        VLSN lastTxnEnd = range.getLastTxnEnd();
        VLSN lastSync = range.getLastSync();

        LoggerUtils.finest(logger, repImpl, "verify rollback" +
                           " vlsn range=" + range +
                           " searchResults=" + searchResults);
        /*
         * If the lastTxnEnd VLSN is null, we don't have to worry about hard
         * recovery. See truth table above.
         */
        if (lastTxnEnd.isNull()) {
            if (range.getLastSync().isNull() && !matchpointVLSN.isNull()) {
                throw EnvironmentFailureException.unexpectedState
                    (repNode.getRepImpl(), "Shouldn't be possible to find a "+
                     "matchpoint of " + matchpointVLSN +
                     " when the sync VLSN is null. Range=" + range);
            }

            /* We'll be doing a normal rollback. */
            LoggerUtils.fine(logger, repImpl, "normal rollback, no txn end");
            return;
        }

        if (lastSync.isNull()) {
            throw EnvironmentFailureException.unexpectedState
                (repNode.getRepImpl(),
                 "Shouldn't be possible to have a null sync VLSN when the "
                 + " lastTxnVLSN " + lastTxnEnd + " is not null. Range=" +
                 range);
View Full Code Here

               InsufficientLogException {

        int matchCounter = 0;
        repImpl.setSyncupProgress(SyncupProgress.FIND_MATCHPOINT,
                                matchCounter++, -1);
        VLSN candidateMatchpoint = range.getLastSync();
        if (candidateMatchpoint.equals(NULL_VLSN)) {

            /*
             * If the replica has no sync-able log entries at all, the
             * matchpoint is the NULL_VLSN, and we should start the replication
             * stream at VLSN 1. Check if the feeder has the VLSN 1. If it
View Full Code Here

        if ((acceptAlternative) &&
            (message instanceof AlternateMatchpoint)) {

            AlternateMatchpoint alt = (AlternateMatchpoint) message;
            InputWireRecord feederRecord = alt.getAlternateWireRecord();
            VLSN altMatchpoint = feederRecord.getVLSN();
            if (range.getFirst().compareTo(altMatchpoint) > 0) {

                /*
                 * The feeder suggest a different matchpoint, but it's outside
                 * the replica's range. Give up and do a network restore.
View Full Code Here

            return (currentEntryHeader.getReplicated());
        }

        @Override
        protected boolean processEntry(ByteBuffer entryBuffer) {
            VLSN currentVLSN = currentEntryHeader.getVLSN();
            long currentLSN = getLastLsn();
           
            if (currentVLSN == null) {
                throw new RuntimeException
                     (DbLsn.getNoFormatString(currentLSN) +
                      "Should be a replicated entry");
            }

            if ((currentVLSN != null) && currentVLSN.isNull()) {
                out1.println("unexpected LSN " +
                            DbLsn.getNoFormatString(getLastLsn()) +
                            " has vlsn " + currentVLSN);
            }

            if ((lastVLSN != null) && lastVLSN.isNull()) {

                /* First entry seen */
                out1.println("first VLSN = " + currentVLSN + " at lsn " +
                            DbLsn.getNoFormatString(getLastLsn()));
            } else if (!currentEntryHeader.isInvisible() &&
                       !currentVLSN.follows(lastVLSN)) {

                /* Note the first entry, check for a gap. */
                out1.println("gap of " +
                            (currentVLSN.getSequence() -
                            lastVLSN.getSequence()) +
                            " Last=" + lastVLSN + " at lsn " +
                            DbLsn.getNoFormatString(lastLSN) +
                            " next=" + currentVLSN + " at lsn " +
                            DbLsn.getNoFormatString(currentLSN));
View Full Code Here

        }
    }

    private int doCompare(long value1, long value2) {
       if (envImpl.isReplicated()) {
           return (new VLSN(value1)).compareTo(new VLSN(value2));
       } else {
           return DbLsn.compareTo(value1, value2);
       }
    }
View Full Code Here

             * supply it.
             * - a RestoreRequest message that indicates that the replica
             * has given up, and will want a network restore.
             */

            VLSN startVLSN = null;
            while (true) {
                Message message = protocol.read(namedChannel);
                if (logger.isLoggable(Level.FINEST)) {
                    LoggerUtils.finest(logger, repImpl,
                                       "Replica " +
View Full Code Here

TOP

Related Classes of com.sleepycat.je.utilint.VLSN

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.