Atomic increment via operate command using java client ( fails

I am trying to do atomic operations on a single bin set. However I am noticing a strange behaviour where randomly record is not getting incremented/decremented. Operate command is returning null in response. Not getting any exception as well. Sometimes it works and sometimes doesn’t.

Attempted to check using both persistent and inmemory storage. It’s a clustered environment of 3 nodes.

For some cases it gave Hot key error which i able to resolve by setting the property transaction-pending-limit = 0.

Aerospike client :


Operate command :

			Record record = aerospikeClient.operate(aerospikeClient.writePolicyDefault, asKey, Operation.add(bin), Operation.get(;

Write policy :

        WritePolicy writePolicy = new WritePolicy();
		writePolicy.socketTimeout = 60000;
		writePolicy.maxRetries = 2;
		writePolicy.sendKey = true;
		writePolicy.expiration = -1; // never expire record

Hi @BreakTheCode, welcome to the community! It looks like you had your question answered over on stackoverflow. I’ll put the link here for reference.

Here is a quick note on cross posting