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