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

com.sleepycat.je.rep

## Class RollbackException

- 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.RollbackException

- All Implemented Interfaces:
    Serializable

      public class RollbackException
      extends RestartRequiredException

  This asynchronous exception indicates that a new master has been selected, this `Replica`'s log is ahead of the current `Master`, and in this case, the `Replica` was unable to rollback without a recovery. As a consequence, it is possible that one or more of the most recently committed transactions may need to be rolled back, before the `Replica` can synchronize its state with that of the current `Master`. Note that any CommitTokens obtained before restarting this `Replica` shouldn't be used after `RollbackException` is thrown because the token may no longer exist on the current `Master` node, due to failover processing.

  Existing `ReplicatedEnvironment`, and consequently `Database` handles, are invalidated as a result of this exception. The application must close all old handles and create new handles before it can proceed. The actual rollback of any recently committed transactions is done when the application re-instantiates and thereby reopens the `ReplicatedEnvironment`. The application is responsible for discarding and recreating any transient state that may be associated with the committed transactions that were rolled back. `getEarliestTransactionId()` and `getEarliestTransactionCommitTime()` provide information to help determine which transactions might be rolled back. Note that it is possible that no committed transactions have been rolled back and that the application need do no adjustments, in which case `getEarliestTransactionCommitTime()` will return null.

  This exception should be encountered relatively infrequently in practice, since the election mechanism favors nodes with the most advanced log when deciding upon a master. The exception, due to its nature, can only be encountered when the node is in the `Replica` state, or the node is trying to transition to the `Replica` state.

  Use of weak durability requirements like `Durability.ReplicaAckPolicy.NONE` or a `ReplicationMutableConfig.NODE_PRIORITY` of zero increases the likelihood of this exception.

  See Also:
    `RollbackProhibitedException`, Serialized Form

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Long` | `getEarliestTransactionCommitTime()` Testing support only.
    `long` | `getEarliestTransactionId()` Testing support only.

    - ### 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

    - #### getEarliestTransactionCommitTime

          public Long getEarliestTransactionCommitTime()

      Testing support only. Return the time in milliseconds of the earliest transaction commit that has been rolled back. May return null if no commits have been rolled back.

    - #### getEarliestTransactionId

          public long getEarliestTransactionId()

      Testing support only. Return the id of the earliest transaction commit that has been rolled back. 0 is returned if no commits have been rolled back.

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