Map Operations CREATE_ONLY doesn't work as expected

Java client 3.2.3 with Aerospike 3.9.02. I’m trying to do a MapOperation.put:

MapPolicy mapPolicyCreateOnly = new MapPolicy(MapOrder.UNORDERED, MapWriteMode.CREATE_ONLY) Operation operation = MapOperation.put(mapPolicyCreateOnly, binName, Value.get(mapKey), Value.get(value)) // Repeaste operation twice - i.e. with the same bin key, map key and value asyncClient.operate(writePolicy, listener, key, operation) asyncClient.operate(writePolicy, listener, key, operation)

According to the javadoc, MapWriteMode.CREATE_ONLY means that the second call to operate should fail. However, this is not the case, and the listener returns onSuccess on both calls: record on first call: (gen:1),(exp:207659863),(bins:(messages:1)) record on second call: (gen:2),(exp:207659863),(bins:(messages:1))

Since the gen was incremented, I assume that the map was modified, even though it shouldn’t. My purpose is to detect duplicate writes of the same map key to the native map record. What am I missing here?

Thanks, Tal

The documentation doesn’t jibe with the current server behavior. The current server does not write the second map operation, but increments the generation anyhow and returns success.

We have decided to change the server to return an error for the second operate() call and not increment the generation. Delivery date is not yet known.

This should be fixed in Aerospike Server 3.9.1.