Could you please give description how updates works in aerospike?

Could you please give description how updates works in Aerospike?

I mean,updates in Aerospike changes only part (bin value) of a record? Or update creates new record and inserts changed values in it?

Thank you!

An update to an existing record will read the previous value of the record, replace/add bins that are changed/added and will re-write the whole record.

There’s no explicit update. There are write operations such as put() and many atomic operations on specific data types, for example add() to a bin with an integer data type.

You can control the behavior through the client’s records exists write policy (in the Java client it’s RecordExistsAction of WritePolicy). The default is an upsert behavior (UPDATE) where if the record / bin aren’t present they will be created by the write operation. If they do exist, the bin values in the write operation will overwrite/operation on the existing bin (comparing put() with add()).

The other values (CREATE_ONLY, UPDATE_ONLY) work more like SQL’s INSERT and UPDATE. They’re explicitly one or the other. If you use CREATE_ONLY and the record already exists you’ll get an exception with the KEY_EXISTS_ERROR result code.

Thank you!

© 2015 Copyright Aerospike, Inc. | All rights reserved. Creators of the Aerospike Database.