Package oracle.kv

Class Consistency.Time

  • All Implemented Interfaces:
    Serializable, oracle.kv.impl.util.FastExternalizable
    Enclosing class:
    Consistency

    public static class Consistency.Time
    extends Consistency
    A consistency policy which describes the amount of time the Replica is allowed to lag the Master. The application can use this policy to ensure that the Replica node sees all transactions that were committed on the Master before the lag interval.

    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:
    Serialized Form
    • Constructor Detail

      • Time

        public Time​(long permissibleLag,
                    TimeUnit permissibleLagUnit,
                    long timeout,
                    TimeUnit timeoutUnit)
        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 - the TimeUnit for the permissibleLag parameter.
        timeout - the amount of time to wait for the consistency to be reached.
        timeoutUnit - the TimeUnit for the timeout parameter.
    • Method Detail

      • getPermissibleLag

        public long getPermissibleLag​(TimeUnit unit)
        Returns the allowed time lag associated with this policy.
        Parameters:
        unit - the TimeUnit of the returned value.
        Returns:
        the permissible lag time in the specified unit.
      • getTimeout

        public long getTimeout​(TimeUnit unit)
        Returns the consistency timeout associated with this policy.
        Parameters:
        unit - the TimeUnit of the returned value.
        Returns:
        the consistency timeout in the specified unit.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object