Search code examples
javaaerospike

Aerospike map operations failing


I am starting new project with Aerospike and wanted to test MapOperation. But all my tests fail with same error.

Here is example of test

    IAerospikeClient client = new AerospikeClientProvider(config).get();

    Key key = new Key("test", "other", "other:1");
    client.delete(client.getWritePolicyDefault(), key);

    Map<Value,Value> inputMap = new HashMap<Value,Value>();
    inputMap.put(Value.get(1), Value.get(55));
    inputMap.put(Value.get(2), Value.get(33));

    // Write values to empty map.
    Record record = client.operate(client.getWritePolicyDefault(), key, 
            MapOperation.putItems(MapPolicy.Default, "mapbin", inputMap));

And this is error

com.aerospike.client.AerospikeException: Error Code 4: Parameter error
at com.aerospike.client.command.ReadCommand.parseResult(ReadCommand.java:121)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:57)
at com.aerospike.client.AerospikeClient.operate(AerospikeClient.java:697)
at de.ascendro.f4m.server.AerospikeDaoTest.operateMapPut(AerospikeDaoTest.java:207)

I am using Aerospike 3.8.2.3 and Aerospike Java client 3.2.4 Do I need specific settings for Aerospike or client to run MapOperation? Or am I doing something wrong?


Solution

  • I manage to run this test.

    Problem was that MapOperation is supported only from Aerospike version 3.9.1.1