Can't have record-level replace when writing null values to bins

Can’t have record-level replace when writing null values to bins

Problem Description

When writing records with the RecordExistsAction.REPLACE policy to Aerospike the following WARNING message is displayed in the server log file:

Jun 26 2019 03:56:34 GMT: WARNING (rw): (write.c:940) {tst} write_master: bin delete can't have record-level replace flag <Digest>:0x75020220f8c3b1988357deb10e03478bf73d5300
Jun 26 2019 04:16:47 GMT: WARNING (rw): (write.c:940) {tst} write_master: bin delete can't have record-level replace flag <Digest>:0x12d0ec9cbb3695827e15b494c74f64182b4d0466
Jun 26 2019 04:16:48 GMT: WARNING (rw): (write.c:940) {tst} write_master: bin delete can't have record-level replace flag <Digest>:0x12d0ec9cbb3695827e15b494c74f64182b4d0466
Jun 26 2019 04:16:49 GMT: WARNING (rw): (write.c:940) {tst} write_master: bin delete can't have record-level replace flag <Digest>:0x12d0ec9cbb3695827e15b494c74f64182b4d0466

Explanation

This error will be thrown when an attempt to write null values for bins into a record is made using the replace write policy (clientPolicy.asyncWritePolicyDefault.recordExistsAction = RecordExistsAction.REPLACE). This may be done in an attempt to remove bins from a record when the overall base record is to be kept. It is not possible to use the REPLACE flag for these operations.

Solution

If the use case is such that a record should be retained but have null values written for some bins (in effect deleting those bins) then the UPDATE operation should be used (RecordExistsAction.UPDATE in the write policy)

Notes

  • If an entire record is to be re-written then RecordExistsAction.REPLACE can be used. If a record, Record1 has bins binA,binB and binC and we wish to amend this such that we have Record1 with binB only we can replace the entire record using RecordExistsAction.REPLACE or we can write nulls to binA and binC using RecordExistsAction.UPDATE but we cannot mix those two methods.
  • Please check the specific client API documentation for exact details of write policy syntax.

Keywords

RECORD-LEVEL REPLACE NULL BIN UPDATE WRITE POLICY ERROR

Timestamp

27 June 2019

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