consistency

consistency [[ABSOLUTE(default) | NONE_REQUIRED] [-time -permissible-lag <time_ms> -timeout <time_ms>]] 

Configures the read consistency used for this session.

The read operations are serviced either on a master or a replica node depending on the configured value. For more details on consistency, see Consistency Guarantees. The following policies are supported. They are defined in the Consistency class of Java APIs.

If you do not specify this value, the default value ABSOLUTE is applied for this session.
  • ABSOLUTE - The read operation is serviced on a master node. With ABSOLUTE consistency, you are guaranteed to obtain the latest updated data.
  • NONE-REQUIRED - The read operation can be serviced on a replica node. This implies, that if the data is read from the replica node, it may not match what is on the master. However, eventually, it will be consistent with the master.

For more details on the policies, see Consistency in the Java Direct Driver API Reference Guide.

Other non-mandatory parameter includes:

-time: Indicates the use of time-based options for tuning the consistency. The following parameters are supported:
  • -permissible-lag: Sets the maximum allowable delay between the replica node and master. Enter the value in milliseconds.
  • -timeout: Configures the request timeout used for this session. The default value is 5000ms.
For example, you can define the consistency as follows:
sql-> consistency ABSOLUTE -time -permissible-lag 1000 -timeout 5000;
The following sample output confirms the applied read policy:
Read consistency policy: Consistency.Time[permissibleLag_ms=1000, timeout_ms=5000]