How to get, examine and update/insert few records in one transaction

Hi, I would like to insert new record, but the value of the record can be dependant on other records. The ideal way would be:

  • start transaction
  • get all connected records if they exist
  • based on them set the value of the new record
  • insert or update the record
  • stop the transaction I would like to avoid modification of dependant records between read and write by the concurrent script.

Is it possible in aerospike? If so, please give me some tips. As I understand UDFs can only work on one record, and it is not possible to make additional gets inside UDF function.

Thanks!

Ela

Are you using Community Edition (CE) or Enterprise Edition (EE)? Reason I ask this … natively you cannot do this in Aerospike. But there could be a way to do this from the application level. However, with any multi-record transaction to be fool proof, you must worry about cluster splitting midway through your transaction. In Aerospike 4.0 EE, you can operate a namespace in Strong Consistency (SC) mode. Without SC mode, one cannot talk about multi-record transactions. So, I don’t see how this can be done on CE which does not offer SC Mode. So, are you looking for an EE solution or a CE solution?

Thank you for your reply. I’m using CE edition. I will try to implement CAS solution than. Probably it won’t be 100% good for all possible cases, but I hope it will be good enough.

Thank you!

CAS works on the same record - to read in first call into the client, modify in client based on what you read, and write back to the same record.