Wrong data type returned when using aerospike_key_operate_async



Using Aerospike C client - 4.0.0 compiled with libev event loop and Aerospike server 3.7.3

I just trying out simple experiment. Append a “str” using new cdt list append operation and then fetching the same using as_operations_add_list_pop_range.

My observation -

Append operation works without any issue (be it sync or async API), problem comes while performing pop_range operation using async API. Data type returned by aerospike_key_operate_async for pop range operation is “AS_BYTES” while data type returned by aerospike_key_operate is “AS_LIST” (which is expected, it’s a list of strings). I am talking about data type of a bin in the record which returned by key operate API or given in callback function in case of async. If I print byte data, it matches ascii value of individual characters of the string which is present in db.

Is there something I am missing ?


Your observation is correct. aerospike_key_operate_async() does not currently respect as_policy_operate.deserialize which would deserialize the wire protocol byte array into a list.

The next release of the C client, 4.0.3, will include the fix. The temporary workaround is to deserialize the list bytes in your code:

as_val* value = 0;

as_buffer buffer;
buffer.data = byte_array;
buffer.size = byte_array_len;

as_serializer ser;
as_serializer_deserialize(&ser, &buffer, &value);