Search code examples
aerospike

Aerospike LDT limit/sort


We want to store some events in reverse chronological order. And we need to retrieve x number of events happened before a given time.

Looking at the java apis, LargeList.findFrom(Value begin, int count) seems like the perfect method we should be using. But using that method throws following error:

    Error Code 100: function not found
    com.aerospike.client.AerospikeException: Error Code 100: function not found
at com.aerospike.client.command.ReadCommand.handleUdfError(ReadCommand.java:154)
at com.aerospike.client.command.ReadCommand.parseResult(ReadCommand.java:118)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:56)
at com.aerospike.client.AerospikeClient.execute(AerospikeClient.java:1016)
at com.aerospike.client.large.LargeList.findFrom(LargeList.java:233)

Here is the source code for findFrom() method:

public List<?> findFrom(Value begin, int count) throws AerospikeException {
return (List<?>)client.execute(policy, key, PackageName, "find_from", binName, begin, Value.get(count));
}

Do we need to define the "find_from" function? Or it should be part of Aerospike installation?

What is the correct way of limit results returned from LLIST?


Solution

  • I was running Build : 3.4.1 running on vagrant vm. After I installed Build #3.5.12 this is no longer an issue. I can now limit results without any issues.

    Not sure if this was a bug or something added to version later than 3.4.1, but this works as expected now.