Is Record UDF calling thread safe?


#1

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


#2

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


#3

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)
else
    ...    
end

#4

Yes.

More info here:

http://stackoverflow.com/questions/25920610/aerospike-acid-clarification


#5

Thanks. The link is helpful