Class Consistency.Version
- All Implemented Interfaces:
- Serializable,- oracle.kv.impl.util.FastExternalizable
- Enclosing class:
- Consistency
Consistency.Version.
 
 The version of a Key-Value pair represents a point in the serialized
 transaction schedule created by the master. In other words, the version
 is like a bookmark, representing a particular transaction commit in the
 replication stream.  The Replica ensures that the commit identified by
 the Consistency.Version has been executed before allowing the transaction on
 the Replica to proceed.
 
For example, suppose the application is a web application. Each request to the web server consists of an update operation followed by read operations (say from the same client). The read operations naturally expect to see the data from the updates executed by the same request. However, the read operations might have been routed to a Replica node that did not execute the update.
 In such a case, the update request would generate a Consistency.Version,
 which would be resubmitted by the browser, and then passed via a
 Consistency.Version object with subsequent read requests to the
 KV Store.  The read request may be directed by the KV Store's load
 balancer to any one of the available Replicas.  If the Replica servicing
 the request is already current (with respect to the version token), it
 will immediately execute the transaction and satisfy the request. If
 not, the transaction will stall until the Replica replay has caught up
 and the change is available at that node.
 
Consistency Timeout
This class has a timeout attribute that 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 SummaryNested classes/interfaces inherited from class oracle.kv.ConsistencyConsistency.NoneRequired, Consistency.Time, Consistency.Version
- 
Field SummaryFields inherited from class oracle.kv.ConsistencyABSOLUTE, NONE_REQUIRED, NONE_REQUIRED_NO_MASTER
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleangetName()Returns the name used to identify the policy.longgetTimeout(TimeUnit unit) Return the timeout specified when creating this consistency policy.Return theVersionused to create this consistency policy.inthashCode()toString()Methods inherited from class oracle.kv.ConsistencyfromByteArray, toByteArrayMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface oracle.kv.impl.util.FastExternalizabledeserializedForm
- 
Constructor Details- 
VersionDefines how current a Replica needs to be in terms of a specific write operation that was previously completed. An operation on a Replica that uses this consistency policy is allowed to start only after the transaction identified by theversionhas been committed on the Replica. The transaction will wait for at mosttimeoutfor the Replica to catch up. If the Replica has not caught up in this period, the client method will throw aConsistencyException.- Parameters:
- version- the token identifying the transaction.
- timeout- the maximum amount of time that the transaction start will wait to allow the Replica to catch up.
- timeoutUnit- the- TimeUnitfor the timeout parameter.
 
 
- 
- 
Method Details- 
getNameDescription copied from class:ConsistencyReturns the name used to identify the policy.- Specified by:
- getNamein class- Consistency
 
- 
getVersionReturn theVersionused to create this consistency policy.
- 
getTimeoutReturn the timeout specified when creating this consistency policy.- Parameters:
- unit- the- TimeUnitof the returned value.
- Returns:
- the timeout specified when creating this consistency policy
 
- 
hashCodepublic int hashCode()
- 
equals
- 
toString
 
-