Aerospike server version: 6.3
Aerospike Java client version: 6.1.1
When I create or update a record with 3 bins (two string values and one a Map), with WritePolicy having RecordExistsAction.REPLACE:
WritePolicy writePolicy = new WritePolicy()
writePolicy.recordExistsAction = RecordExistsAction.UPDATE;
);
Key key = new Key("namespace", null, "1");
aerospikeClient.put(writePolicy, key,
new Bin("id", "1"), new Bin("type", "app"), //string values
new Bin("list_id", ImmutableMap.of("123", 2345L)) //map object
);
The client fails throwing an exception:
com.aerospike.client.AerospikeException: Error 4,1,0,30000,1000,0,BBBB 10.X.X.X 3000: Parameter error
at com.aerospike.client.command.WriteCommand.parseResult(WriteCommand.java:82)
at com.aerospike.client.command.SyncCommand.executeCommand(SyncCommand.java:103)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:63)
at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:481)
However when I try the same update using RecordExistsAction.UPDATE in the Write policy the write/update succeeds.
@pgupta I added the code. I do not see this error when testing the write on a Docker image “aerospike:ee-6.3.0.2_1”. I see the error only when I send this write to a cluster running 6.3.x.
Hi Shan. Your code looks like it should work (apart from a couple of minor compile errors). I’ve been able to run it in my environment with no issues. You’re using the null set which is ok, but the vast majority of applications would have a set name in there. (A set is like a table in relational concepts, so it allows for different business objects like Customers and Addresses to be grouped together).
When you get a Parameter Error, there is quite often more information in the server log about what is happening. So if you’re able to reproduce the error at will, can you please tail the log on the server where the record resides when the error occurs and see if there’s more information in there? That would help us guide you to solving the problem.
If you have multiple nodes in the cluster, it needs to be the node which holds the record. This is easy to tell via AQL:
aql> explain select * from test where pk = "1"
+--------------------------------------------+----------+-------------------+-----------+-----------+----------------------+-----+--------+---------+---------+
| DIGEST | KEY_TYPE | MASTER NODE | NAMESPACE | PARTITION | POLICY_KEY | SET | STATUS | TIMEOUT | UDF |
+--------------------------------------------+----------+-------------------+-----------+-----------+----------------------+-----+--------+---------+---------+
| "B5C4A6BECFB3398605BEDD937F9AE941D0CEE1DE" | "STRING" | "BB963931E03E652" | "test" | 1205 | "AS_POLICY_KEY_SEND" | "" | "" | 1000 | "FALSE" |
+--------------------------------------------+----------+-------------------+-----------+-----------+----------------------+-----+--------+---------+---------+
1 row in set (0.003 secs)
So in this case the node would be BB963931E03E652. (Your node will obviously be different, but this shows you how to get the particular node) You can then use asadm’s info command to map this back to the node on which to tail the log.
Please post what the error is in the log so we can help more.
@shan.p – That makes sense now. I’m assuming in your namespace you have conflict-resolve-writes set to true? Hence you’re using bin convergence and replaces are not allowed on replaces as replace blindly overwrites the existing record. This can cause the loss of bin-level LUTs (Last update times) on older bins, thereby preventing convergence from working. Please see Bin convergence | Aerospike Documentation for more details, especially the section on “Record replace not allowed”.
Please let me know if there are any further questions.