Class Consistency.Time
- All Implemented Interfaces:
Serializable
,oracle.kv.impl.util.FastExternalizable
- Enclosing class:
- Consistency
Effective use of this policy requires that the clocks on the Master and Replica are synchronized by using a protocol like NTP.
Consistency Timeout
Besides the lag time, this class has a timeout
attribute. The timeout controls how long a Replica may wait
for the desired consistency to be achieved before giving
up.
All KVStore read operations support a Consistency specification, as well as a separate operation timeout. The KVStore client driver implements a read operation by choosing a node (usually a Replica) from the proper replication group, and sending it a request. If the Replica cannot guarantee the desired Consistency within the Consistency timeout, it replies to the request with a failure indication. If there is still time remaining within the operation timeout, the client driver picks another node and tries the request again (transparent to the application).
It makes sense to think of the operation timeout as the maximum amount of time the application is willing to wait for the operation to complete. The Consistency timeout is like a performance hint to the implementation, suggesting that it can generally expect that a healthy Replica usually should be able to become consistent within the given amount of time, and that if it doesn't, then it is probably more likely worth the overhead of abandoning the request attempt and retrying with a different replica. Note that for the Consistency timeout to be meaningful it must be smaller than the operation timeout.
Choosing a value for the operation timeout depends on the needs of the application. Finding a good Consistency timeout value is more likely to depend on observations made of real system performance.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class oracle.kv.Consistency
Consistency.NoneRequired, Consistency.Time, Consistency.Version
-
Field Summary
Fields inherited from class oracle.kv.Consistency
ABSOLUTE, NONE_REQUIRED, NONE_REQUIRED_NO_MASTER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getName()
Returns the name used to identify the policy.long
getPermissibleLag
(TimeUnit unit) Returns the allowed time lag associated with this policy.long
getTimeout
(TimeUnit unit) Returns the consistency timeout associated with this policy.int
hashCode()
toString()
Methods inherited from class oracle.kv.Consistency
fromByteArray, toByteArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface oracle.kv.impl.util.FastExternalizable
deserializedForm
-
Constructor Details
-
Time
Specifies the amount of time by which the Replica is allowed to lag the master when initiating a transaction. The Replica ensures that all transactions that were committed on the Master before this lag interval are available at the Replica before allowing a transaction to proceed.Effective use of this policy requires that the clocks on the Master and Replica are synchronized by using a protocol like NTP.
- Parameters:
permissibleLag
- the time interval by which the Replica may be out of date with respect to the Master when a transaction is initiated on the Replica.permissibleLagUnit
- theTimeUnit
for the permissibleLag parameter.timeout
- the amount of time to wait for the consistency to be reached.timeoutUnit
- theTimeUnit
for the timeout parameter.
-
-
Method Details
-
getName
Description copied from class:Consistency
Returns the name used to identify the policy.- Specified by:
getName
in classConsistency
-
getPermissibleLag
Returns the allowed time lag associated with this policy.- Parameters:
unit
- theTimeUnit
of the returned value.- Returns:
- the permissible lag time in the specified unit.
-
getTimeout
Returns the consistency timeout associated with this policy.- Parameters:
unit
- theTimeUnit
of the returned value.- Returns:
- the consistency timeout in the specified unit.
-
hashCode
public int hashCode() -
equals
-
toString
-