Versions Compared

Key

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

...

The data got inserted into user table and got updated as above batch execution

...

.
The WriteTimeoutException.getWriteType() == BATCH, ensures data is inserted into the table

Approach

To handle above WriteTimeoutException we can use BatchStatement.Type

Code Block
BatchStatement batchStatement = new BatchStatement(BatchStatement.Type.UNLOGGEDLOGGED);

There is 3 different types are present

  1. LOGGED

  2. UNLOGGED

...

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.

...

Batch type of LOGGED, guarantees atomic insertion of data, and WriteTimeoutException.getWriteType() == BATCH, eventually written to the appropriate replicas and the developer doesn't have to do anything.

Thus, the above two checks handles partial write.