ListOperation usage

Hi all,

I’m getting started with the ListOperation in the Java client, and the operations do not work as expected. Here are my code:

AerospikeClient client = new AerospikeClient("10.0.0.1", 3000);
Key key = new Key("test", "demo", "testlist");
Value vll = Value.get(123);
List<Value> itemList = new ArrayList<Value>();
itemList.add(Value.get("s11"));
itemList.add(Value.get("s22222"));
Bin bin01 = new Bin("bin3", Value.get(itemList));
client.put(null, key, bin01);
Record record0 = client.operate(null, key, Operation.put(new Bin("bin4", 90)), ListOperation.insertItems("bin6", 0, itemList) , Operation.get());
System.out.println("record0");
System.out.println(record0);
Record record1 = client.operate(null, key, ListOperation.append("bin3", vll), Operation.get());
System.out.println("record1");
System.out.println(record1);
itemList.add(Value.get("s3333333"));
itemList.add(Value.get("s4444444444"));
itemList.add(Value.get("s5555555555555555"));
Record record2 = client.operate(null, key,
        ListOperation.insertItems("bin3", 0, itemList), Operation.get()
);
System.out.println("record2");
System.out.println(record2);
Record record3 = client.get(null, key);
System.out.println("record3");
System.out.println(record3);

And here are the output:

record0 (gen:2),(exp:239021264),(bins:(bin3:[s11, s22222]),(bin4:90)) record1 (gen:3),(exp:239021264),(bins:(bin3:[s11, s22222]),(bin4:90)) record2 (gen:4),(exp:239021265),(bins:(bin3:[s11, s22222]),(bin4:90)) record3 (gen:4),(exp:239021265),(bins:(bin3:[s11, s22222]),(bin4:90))

It seems that all of the ListOperations used in my code were not applied. Am I using it wrong?

Thanks.

Can you remove the ‘bin6’ operation and retry the rest of your code? Does not look like you are doing something obviously incorrect.

I’ve removed the line, the result is still the same.

There is a bare bones example here: aerospike-client-java/OperateList.java at master · aerospike/aerospike-client-java · GitHub

Can you reproduce that example?

Running the example yields the following:

2017-06-30 08:53:33 SGT INFO OperateList Begin 2017-06-30 08:53:33 SGT INFO CDT list functions are not supported by the connected Aerospike server. 2017-06-30 08:53:33 SGT INFO OperateList End

Here are the features available on the database (notice that CDT list is not avaiable)

as_msg;replicas-read;replicas-prole;replicas-write;replicas-master;cluster-generation;partition-info;partition-generation;udf

How do I enable CDT list on the Aerospike server? I couldn’t find any instructions on http://www.aerospike.com/docs/guide/cdt-list.html or any related page.

Thanks.

What is your server version?

The server version is 3.3.21

Going through release notes, I believe list operations were introduced in 3.7.0.1 - Aerospike Server CE Release Note | Download | Aerospike and list-index in 3.8+ – so really you need to upgrade your server. See the release blog for 3.7 here: Aerospike 3.7.0 Release | Aerospike

Ah I see, thanks for your help!

Can you close the item on stackoverflow? Thanks.