aerospike-client-nodejs icon indicating copy to clipboard operation
aerospike-client-nodejs copied to clipboard

Not obvious error message when trying to set TTL

Open iblessedi opened this issue 2 years ago • 2 comments

I tried to perform a simple put event like client.put(key, bins, { ttl: 1 }); and got an error "AerospikeError: Operation not allowed at this time."

After debugging I found that the problem was with TTL. I need to set allow-ttl-without-nsup true to change TTL to anything other than 0 and -1. This helped, but the error message is weird - it's very difficult to understand that "operation not allowed at this time" is connected to setting TTL. Could you improve the message, so it would be understandable the actual error? Thanks.

iblessedi avatar Mar 08 '22 15:03 iblessedi

Don't use allow-ttl-without-nsup as this will leave stale records on your database - they will never purge. See here for more details: https://discuss.aerospike.com/t/faq-what-is-allow-ttl-without-nsup-used-for/8282.

The correct solution would be to set the nsup-period (https://docs.aerospike.com/reference/configuration/index.html#nsup-period) to a value bigger than 0 if you need to use TTL.

Regarding the unhelpful error message - I agree. This should be more understandable.

realmgic avatar Mar 08 '22 19:03 realmgic

Thank you! Yes, I set nsup-period and it works, no warnings. But the purpose of this issue is highlight weird error message. May it be improved to something more obvious? Thanks!

iblessedi avatar Mar 09 '22 08:03 iblessedi