A setting that defines a successful write or read by the number of cluster replicas that acknowledge the write or respond to the read request, respectively.
The default consistency is CASS_CONSISTENCY_LOCAL_ONE for driver versions 2.2.2 and above. In the past, versions 2.2.1 and below, it was CASS_CONSISTENCY_QUORUM or CASS_CONSISTENCY_ONE depending on the driver version.
The consistency level determines the number of replicas on which the read/write must respond/succeed before returning an acknowledgment to the client application. Descriptions and Usage scenarios for each read/write consistency level can be found here.
NOTE: Consistency level CASS_CONSISTENCY_ANY is only valid for write operation statements.
A ‘CassStatement’ object can have its consistency level altered at anytime before the statement is executed by the session.
CassStatement* statement = NULL; /* Create a simple or prepared statment */ /* Ensure the session executed statement has strong consistency */ cass_statement_set_consistency(statement, CASS_CONSISTENCY_QUORUM); cass_statement_free(statement);
NOTE: Consistency level is ignored for USE, TRUNCATE, CREATE and ALTER statements, and some, like CASS_CONSISTENCY_ANY, aren’t allowed in all situations.