Lua Aerospike记录UDF是原子的吗?

Lua Aerospike记录UDF是原子的吗?,lua,atomicity,aerospike,Lua,Atomicity,Aerospike,Aerospike记录是UDF原子的吗 function increment_and_expire(rec, incValue, expireThreshold, currentTime) if aerospike:exists(rec) then local timesUsed = rec['timesUsed'] if timesUsed == expireThreshold or rec['validUpto'] < current

Aerospike记录是UDF原子的吗

function increment_and_expire(rec, incValue, expireThreshold, currentTime)
      if aerospike:exists(rec) then
          local timesUsed = rec['timesUsed']
          if timesUsed == expireThreshold or rec['validUpto'] < currentTime then
            rec['expired'] = true
        else
            rec['timesUsed'] = timesUsed + incValue
        end
        aerospike:update(rec)
        return 1
    else
        warn("record doesn't exists")
        return -1
    end
end
函数增量和过期(rec、incValue、expireThreshold、currentTime)
如果aerospike:存在(rec),则
本地时间使用=rec['timessused']
如果timesUsed==expireThreshold或rec['validUpto']
上面的Lua函数增加令牌的使用量,如果令牌不再有效,则将其标记为过期。
现在我的疑问是,如果并发请求是针对同一条记录的,并且这个函数是并发执行的,那么这会导致任何问题吗?

您所问的是隔离性,而不是真正的原子性。Aerospike按每个键以串行方式执行所有事务。也就是说,一个写事务可以在任何给定的时间点在一个键上激活。其他人都被迫等待。执行顺序不一定是FIFO,而是序列化的。udf也是如此