Operate v/s Put


How Aerospike locking works for Operate operation. Since operate supports multiple operations, how lock works for “operate” ? Is lock taken at Block level or at record level for “operate” ?


Operate allows you to perform multiple operations on a single record, during which time a lock is held for that record only. For example, you can use operate to insert a new element to a KV-ordered map, remove-by-rank the element with the lowest rank, then read the value of the new lowest ranked element.

In high availability mode (AP), the one mode available to community edition, every update is a copy-on-write into a new block (new inserts obviously go into new blocks). Blocks are immutable and there’s no reason to lock them for read operations - again, they will not be taking new writes until they’re fully defragmented and written over completely. This is also the case for strong consistency modes, unless you set commit-to-device to true.