Batch Writing of Records in Aerospike

I have to write a batch function which will save my data currently I have implemented as 1.Storing the sets in batch of 100 2. Assigning all the batch to a particular key

This way we are storing the records with async client.But this leads to inconsistency in data. If two same keys come simultaneously in function it is just making data inconsistent. Is there anyway we can stop this inconsistency.

Can you please clarify your update scenario?

1.Storing the sets in batch of 100

It sounds like you are creating/updating multiple independent records in batches of 100.

  1. Assigning all the batch to a particular key

It is not clear what you mean by assigning the batch to a particular key. It sounds like (although it conflicts with 1 above) that the same record (key) is being updated concurrently (with the async client).

If two same keys come simultaneously in function it is just making data inconsistent.

Maybe you are using a “key” to mean something different from a record id.

Please clarify what each update in a batch of 100 looks like and how a “key” relates to it.

© 2021 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.