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 {@link com.sleepycat.je.Durability} policy that specifies a{@link com.sleepycat.je.Durability.ReplicaAckPolicy ReplicaAckPolicy} ofNONE.
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 {@link ReplicationConfig#TXN_ROLLBACK_LIMIT}, JE will automatically truncate the environment log to remove the unreplicated transactions, and will throw a {@link RollbackException}. The application only needs to reinstantiate the ReplicatedEnvironment and proceed on. If the limit specified by {@link ReplicationConfig#TXN_ROLLBACK_LIMIT} is exceeded, the application willreceive 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 {@link com.sleepycat.je.util.DbTruncateLog}.
Note that any CommitTokens obtained before restarting this Replica
shouldn't be used after {@link RollbackProhibitedException} is thrown because the token may no longer exist on the current Master
node.
|
|
|
|