The Aerospike Knowledge Base has moved to https://support.aerospike.com. Content on https://discuss.aerospike.com is being migrated to either https://support.aerospike.com or https://docs.aerospike.com. Maintenance on articles stored in this repository ceased on December 31st 2022 and this article may be stale. If you have any questions, please do not hesitate to raise a case via https://support.aerospike.com.
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 binsbinA
,binB
andbinC
and we wish to amend this such that we haveRecord1
withbinB
only we can replace the entire record usingRecordExistsAction.REPLACE
or we can write nulls tobinA
andbinC
usingRecordExistsAction.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