Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
PreparedStatement preparedStatement = session.prepare("insert into test2test.user (id, name) values (?, ?)");
PreparedStatement preparedStatement2 = session.prepare("update test2test.user set id='id_updated-1' where name=?");
PreparedStatement preparedStatement3 = session.prepare("update test2test.user set id='id_updated-2' where name=?");


int i = 1;
while(i <= 1000) {
	batchStatement.add(preparedStatement.bind("id_"+i, "user-" + i));
	++i;
}

batchStatement.add(preparedStatement2.bind("user-1"));
batchStatement.add(preparedStatement3.bind("user-2"));

...

Code Block
Caused by: com.datastax.driver.core.exceptions.WriteTimeoutException: Cassandra timeout during write query at 
consistency ONEQUORUM (12 replica were required but only 01 acknowledged the write)

Observation

...

There is 3 different types are present

  1. BATCH_LOG

  2. BATCHLOGGED

  3. UNLOGGED_BATCH

  • In cassandra doc it specifies that to increase the performance UNLOGGED

...

  • type should get use.

  • With LOGGED type the data got inserted and updated after WriteTimeoutException.

  • With UNLOGGED type the data got inserted and updated after WriteTimeoutException.