Is Record UDF calling thread safe?


If multi-threads call UDF function(with write-operation) on same record, there have internal locks or something else to protect the data?


Yes, records are locked during write operations (from either the client or from record UDF).


Locked when writing operation. How about reading?

Calling as_operations_add_incr(ops, “bin”, 1) from client should be thread-safe.

But calling a lua function below thread-safe ? :

if aerospike:exists(rec) then

    local v = rec['bin']
    rec['bin'] = v + 1

	return aerospike:update(rec)



More info here:


Thanks. The link is helpful