I have a function that clears a specified bin:
local function clear(rec, id)
rec[MAP_BIN_PREFIX .. tostring(id)] = nil
info('data: ' .. tostring(rec[MAP_BIN_PREFIX .. tostring(id)]))
aerospike:update(rec)
end
When an info statement printing the bin data occurs after bin erasure but before the record is updated (i.e. as shown above), two anomalies happen:
- (1) the info() statement prints the original bin state (not the nil state)
- (2) no changes are persisted to database
Simply removing the info() line fixes this issue.
This looks like a bug to me. It stumped me for a good while, especially because I was using info statements to debug the problem, but I think the above description is accurate now.
Perhaps the Aerospike Team could take a look or give some tips about this behaviour?