Record locking semantics

Hi, Needed information regarding record locking in case of udf’s with respect to following two cases-

  1. Since stream udf’s are read only, do they perform record locking?
  2. Record udf’s can write/update. Do they hold locks for the duration of the udf execution? How does this affect concurrent invocations of the same record udf ? Are they executed serially so as to achieve mutual exclusion? Locking in general will affect consistency/performance as well. Need precise behavior information so as to design queries effectively.

Kratos,

Aerospike’s locking / latching is per-record - ie, per key-value pair. A standard UDF must hold the read-write lock while executing, but other UDFs ( on other records ) run in parallel. For a stream udf ( aggregation ), when each record has the UDF executing on it, it holds a read lock. The read locks are slightly lighter weight than the write latch. The write latch is used during the period where replication to other nodes in the cluster is applied, as most people run Aerospike’s default mode of synchronous replication.