FAQ - Where can the consistencyLevel Java client property be found for write operations?

FAQ - Where can the consistencyLevel Java client property be found for write operations?


In Aerospike Java client versions prior to version 4.4.0 there was a property called consistencyLevel used with the server running in AP mode which allowed the user to specify read consistency options. From version 4.4.0 of the Java client this was renamed to ReadModeAP and a ReadModeSC property was added for availability mode and strong consistency mode namespaces respectively. The previous consistencyLevel property could be referenced in write operations. What is the equivalent now that consistencyLevel has been deprecated?


Strictly speaking WritePolicy can reference ReadModeAP because WritePolicy inherits from Policy, however, in real terms this has no meaning as there are specific parameters used to control behaviour of write transactions in AP mode.

Quick reference:

  • ReadModeAP controls duplicate resolution, possible values being ALL (enabling duplicate resolution) and ONE (disabling duplicate resolution).
  • ReadModeSC controls consistency options in strong-consistency enabled namespaces, possible values being: ALLOW_REPLICA, ALLOW_UNAVAILABLE, LINEARIZE and SESSION.

For write transactions, the server parameter disable-write-dup-res controls duplicate resolution (default is on).

At first glance it may appear as though the client side parameter commitLevel is similar in nature. This is not the case. Unlike disable-write-dup-res which controls behaviour during migration, commitLevel and the server side write-commit-level-override parameter determine when the server acknowledges a successful write. The default behaviour is to wait until replica writes have been completed however it is possible to switch on a ‘fire and forget’ mode that returns success to the client as soon as the master write has completed.


  • All changes in the Aerospike Java Client API are listed in the Incompatible API Changes document.
  • ReadModeSC presents options in terms of ‘relaxed reads’ which give granular control over when a client read may be permitted and which copy is read.
  • In a strong consistency namespace duplicate resolution will always take place (not configurable).
  • In a strong consistency namespace commitLevel and write-commit-level-override do not apply.




November 2019

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.