Below is the query using gocql
driver:
insertQueryString = "INSERT INTO my_table (id_1, id_2, textDetails) " + "VALUES (?, ?, ?) IF NOT EXISTS"
cassandra.Session.Query(insertQueryString,
id1,
id2,
myTextDetails).Exec();
Table schema in Cassandra 3.0 is:
CREATE TABLE IF NOT EXISTS my_table (
id_1 UUID,
id_2 UUID,
textDetails TEXT,
PRIMARY KEY (id_1, id_2)
);
We have a scenario for above INSERT
query initiated on multiple Go-routines(http handler) with same column value combination of (id_1, id_2)
,
then,
Does Cassandra ensures that only first
INSERT
operation is executed successfully? and errors out the subsequent INSERT
requests with existing value combination of (id_1, id_2)
in database