javaspring-bootaerospike

How to achieve Transactional with Spring-boot-aerospike as we are updating mutliple sets in a request


I am new to Aerospike DB and hoping to try transactional.

We have an API which updates TableA and TableB in a single request. Now, how can I make my request transactional where atomicity is achieved?


Solution

  • Aerospike doesn't support multi record transactions natively yet.

    There is a non-official way to achieve multi record transactions:

    https://aerospike.com/blog/multi-record-transactions-for-aerospike/

    https://github.com/aerospike-examples/atomicMultiRecordTxn

    But it has flaws (https://github.com/aerospike-examples/atomicMultiRecordTxn#caveats) and it's not supported in Spring Data Aerospike - you added a spring-boot tag so I assume you are using Spring Data Aerospike.

    An alternative approach could involve modeling your data differently, potentially eliminating the need for multi-record transactions. Aerospike supports a rich data model which includes Maps and Lists, check out: https://docs.aerospike.com/server/guide/data-types/overview