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);

Below are the two batch types we executed for partial writes

  1. LOGGED

  2. UNLOGGED

...

LOGGED and UNLOGGED batch types, inserts data and return success response even with acknowledgement error.

...

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.