RollbackProhibitedException (Oracle - Berkeley DB Java Edition API)
Date: 2014-12-16

com.sleepycat.je.rep

## Class RollbackProhibitedException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - com.sleepycat.je.DatabaseException
        - - com.sleepycat.je.RunRecoveryException
          - - com.sleepycat.je.EnvironmentFailureException
            - - com.sleepycat.je.rep.RestartRequiredException
              - - com.sleepycat.je.rep.RollbackProhibitedException

- All Implemented Interfaces:
    Serializable

      public class RollbackProhibitedException
      extends RestartRequiredException

  This exception may be thrown by a Replica during the replication stream sync-up phase of startup. It indicates that a syncup cannot proceed without undoing a number of committed transactions that exceeds the limit defined by `ReplicationConfig.TXN_ROLLBACK_LIMIT`.

  It is rare for committed transactions to be rolled back during a sync-up. One way this can happen is if a replication group has been executing with a `Durability` policy that specifies a `ReplicaAckPolicy` of NONE.

  When ReplicaAckPolicy.NONE is specified, transactions can commit on the master without receiving any acknowledgments from replica nodes. Using that policy, it is possible that if the master node crashes at a given time, and the group fails over and continues on with a new master, the old master's environment will have transactions on disk that were never replicated and received by other nodes. When this old master comes back up and rejoins the group as a replica, it will have committed transactions that need to be rolled back.

  If the number of committed transactions to be rolled back is less than or equal to the limit specified by `ReplicationConfig.TXN_ROLLBACK_LIMIT`, JE will automatically truncate the environment log to remove the unreplicated transactions, and will throw a `RollbackException`. The application only needs to reinstantiate the ReplicatedEnvironment and proceed on. If the limit specified by `ReplicationConfig.TXN_ROLLBACK_LIMIT` is exceeded, the application will receive a RollbackProhibitedException to indicate that manual intervention is required.

  The RollbackProhibitedException lets the user interject application specific processing before the log is truncated. The exception message and getter methods indicate the number of transactions that must be rolled back, and the time and id of the earliest targeted transaction, and the user can use this information to make any desired application adjustments. The application may then manually truncate the log using `DbTruncateLog`.

  Note that any CommitTokens obtained before restarting this `Replica` shouldn't be used after `RollbackProhibitedException` is thrown because the token may no longer exist on the current `Master` node.

  See Also:
    Serialized Form

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Long` | `getEarliestTransactionCommitTime()` Return the time in milliseconds of the earliest transaction commit that will be rolled back if the log is truncated to the location specified by `getTruncationFileNumber()` and `getTruncationFileOffset()`
    `long` | `getEarliestTransactionId()` Return the id of the earliest transaction commit that will be rolled back if the log is truncated to the location specified by `getTruncationFileNumber()` and `getTruncationFileOffset()`
    `long` | `getTruncationFileNumber()`
    `long` | `getTruncationFileOffset()` The JE log must be truncated to this offset in the specified file in order for this node to rejoin the group.

    - ### Methods inherited from class com.sleepycat.je.EnvironmentFailureException

      `getMessage`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getTruncationFileNumber

          public long getTruncationFileNumber()

    - #### getTruncationFileOffset

          public long getTruncationFileOffset()

      The JE log must be truncated to this offset in the specified file in order for this node to rejoin the group.

    - #### getEarliestTransactionCommitTime

          public Long getEarliestTransactionCommitTime()

      Return the time in milliseconds of the earliest transaction commit that will be rolled back if the log is truncated to the location specified by `getTruncationFileNumber()` and `getTruncationFileOffset()`

    - #### getEarliestTransactionId

          public long getEarliestTransactionId()

      Return the id of the earliest transaction commit that will be rolled back if the log is truncated to the location specified by `getTruncationFileNumber()` and `getTruncationFileOffset()`

Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.