LDT throws an error when reading value that does not exist


#1

Whenever try to get/find a non existent key the LDT’s UDF will throw a AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND, an it can’t be catched using pcall. Is there a way for knowing that the key is on the LDT?


#2

For this very reason, we have added an exists() function to lmap that behaves similarly to lset exists(). It returns a 1 if the name/key is there, else it returns a 0. It’s brand new, so it will be in the latest release, but you will not see it in the external documentation for a while.


#3

It’s well documented on lmap.lua but not on these link

http://www.aerospike.com/docs/udf/ldt/lmap.html http://www.aerospike.com/docs/guide/lmap.html


#4

That is correct. Like I said. It is in the lua code, but will not be in the external documentation for a while.


#5

But what i see on the lmap.lua is only ldt_exists(topRec, ldtBinName) and not the exists(topRec, ldtBinName, searchName)


#6

I’ll bet the open source release is a little bit further behind than I realized. It should be available in the next release. I’ll check the server release numbers today to verify.


#7

I encountered this error with llist: aql> execute llist.find(idx, ‘abc’) on test.geoIdx where PK='3324’ Error: (100) /opt/aerospike/sys/udf/lua/ldt/lib_llist.lua:6834: 0125:LDT-Item Not Found

Two problems here:

  • llist.exist() is not implemented in github

  • The lua script returns error 125 indicating ldt_item_not_exist. However, client get error 100 which means UDF execution error. This prevents client code to examine whether the error is 125.

In anycase, I think it’s better to not return an error if lxxx.find() cannot find the key. Simply return nil makes client code easier to handle and meet our expectation with experience from other key-value store.


#8

lming,

Both should get addressed in upcoming release.

– R


#9

Thanks R.

What’s the estimate date of next release?


#10

Exact date not sure. But should be next few weeks …

You will see notification on discuss when it is out

– R


#11

Thanks. Look forward to it!


#12

Hi Raj and Toby,

I have aerospike C client code in which the “lmap” lua module has the exists(topRec, ldtBinName, searchName) function. I am calling this function from my udf, but still I get the AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND error.

Here is my UDF function:

local lmap_lib = require('ldt/lib_lmap');
function getmany(rec, binname, keys)
    local resultmap = map()
    local keycount  = #keys
    for i = 1,keycount,1 do
        local rc = lmap_lib.exists(rec, binname, keys[i])
        if (rc == 1) then
            resultmap[keys[i]] = lmap_lib.get(rec, binname, keys[i]);
        else
            resultmap[keys[i]] = nil;
        end
    end
    return resultmap;
end

This is my aql command. Here item “a” is not present into lmap

aql> execute ldt_in_udf.getmany('bin', 'JSON["b", "a"]') on test.demo where PK='1'
Error: (125) AEROSPIKE_ERR_LARGE_ITEM_NOT_FOUND

Can you please tell me what is the reason for this error ?


#13

Ganesh,

Lmap/lset/lstack has been deprecated. Please use llist. Llist is B+tree sorted over key. Provides all the LMAP functions.

The corresponding change in the llist was the question originally about. And that has already been fixed.

HTH

– R


#14

@arypurnomoz, @lming, @ganeshnikam18 :

Thank you for posting about LDTs in our forum. Please see the LDT Feature Guide for current LDT recommendations and best practices.


#15

@arypurnomoz, @lming and ganesh,

Effective immediately, we will no longer actively support the LDT feature and will eventually remove the API. The exact deprecation and removal timeline will depend on customer and community requirements. Instead of LDTs, we advise that you use our newer List and SortedMap APIs, which are now available in all Aerospike-supported clients at the General Availability level. Read our blog post for details.