Berkeley DB Java Edition
version 5.0.34

com.sleepycat.je.rep
Class RollbackProhibitedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by com.sleepycat.je.DatabaseException
                  extended by com.sleepycat.je.RunRecoveryException
                      extended by com.sleepycat.je.EnvironmentFailureException
                          extended by com.sleepycat.je.rep.RestartRequiredException
                              extended by 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
 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()
 String getMessage()
           
 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 java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, 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

getMessage

public String getMessage()
Overrides:
getMessage in class EnvironmentFailureException

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()


Berkeley DB Java Edition
version 5.0.34

Copyright (c) 2004-2011 Oracle. All rights reserved.