public interface ReplicatedDatabaseTrigger extends Trigger
WARNING: This interface is not currently supported. This means that, on a replica where transactions may be rolled back without a full environment shutdown, the repeatXxx methods cannot be used to handle this circumstance. To be safe, it is best to only use TransactionTrigger methods, namely TransactionTrigger.commit.
WARNING: Only transient triggers are currently supported, and the documention below has not yet been updated to reflect this fact. See details at the top of Trigger.java.
The trigger methods can be invoked in one of two circumstances:
These trigger methods are only invoked if the partial transactions contain operations associated with triggers.
Consider a transaction consisting of two put operations:put k1 put k2 commit tIn the absence of a replica or master failure this would normally result in the sequence of trigger calls:
Trigger.put(t, k1, ...) Trigger.put(t, k2,....) Trigger.commit(t)If the replica failed in the midst of the transaction replay, immediately after the first put operation, the sequence of trigger invocations before the replica went down would be:
Trigger.put(k1, ...)followed by the trigger calls below when the replica handle was subsequently reopened:
ReplicatedTrigger.repeat(t) Trigger.repeatPut(t, k1, ...) Trigger.put(t, k2, ...) Trigger.commit(t)The interface defines one "repeat" trigger method for each of the trigger methods defined by Trigger. The methods are distinct from those defined by Trigger to highlight the fact that the trigger method is being invoked a second time for the same operation and the trigger method may not have completed the actions it intended to take when it was invoked the first time. For example, the trigger method may have been used to update a couple of local indexes and it was only finished with updating one local index and persisting it before the replica crashed. As a result the method may need to take special action to repair state maintained by it.
A ReplicatedTrigger is associated with a replicated database via DatabaseConfig.setTriggers
. For a replicated
database, the ReplicatedTrigger interface must be implemented for all
triggers. For a non-replicated database, implementing the ReplicatedTrigger
interface is allowed, but the ReplicatedTrigger methods will not be called.
Modifier and Type | Method and Description |
---|---|
void |
repeatAddTrigger(Transaction txn)
The trigger method invoked when an addTrigger operation needs to be
repeated.
|
void |
repeatCreate(Transaction txn)
The trigger method invoked when a database create trigger needs to be
repeated.
|
void |
repeatDelete(Transaction txn,
DatabaseEntry key)
The trigger method invoked when a database delete trigger needs to be
repeated.
|
void |
repeatPut(Transaction txn,
DatabaseEntry key,
DatabaseEntry newData)
The trigger method invoked when a database put trigger needs to be
repeated.
|
void |
repeatRemove(Transaction txn)
The trigger method invoked when a database remove trigger needs to be
repeated.
|
void |
repeatRemoveTrigger(Transaction txn)
The trigger method invoked when a removeTrigger operation needs to be
repeated.
|
void |
repeatRename(Transaction txn,
java.lang.String newName)
The trigger method invoked when a database rename trigger needs to be
repeated.
|
void |
repeatTransaction(Transaction txn)
Used to inform the application that the trigger method calls associated
with the partial transaction will be repeated.
|
void |
repeatTruncate(Transaction txn)
The trigger method invoked when a database truncate trigger needs to be
repeated.
|
addTrigger, delete, getDatabaseName, getName, put, removeTrigger, setDatabaseName
void repeatTransaction(Transaction txn)
txn
- the partial transactionvoid repeatAddTrigger(Transaction txn)
void repeatRemoveTrigger(Transaction txn)
void repeatCreate(Transaction txn)
void repeatRemove(Transaction txn)
void repeatTruncate(Transaction txn)
void repeatRename(Transaction txn, java.lang.String newName)
void repeatPut(Transaction txn, DatabaseEntry key, DatabaseEntry newData)
Trigger.put
method in that it omits the
oldData
argument.void repeatDelete(Transaction txn, DatabaseEntry key)
Trigger.delete
method in that it omits the
oldData
argument.Trigger#remove
Copyright (c) 2004-2012 Oracle. All rights reserved.