Search code examples
aerospike

Clarification regarding Bin.asNull vs real null value vs thombstone


I'm looking for some clarification regarding what happening and how it affects the inter and between cluster replication between the following operations:

 def test() = {
    val key = new Key("ns", Configuration.dummySetName, 2)
    client.put(null, key, new Bin("bin0", Value.NULL)) // Is that Thombstone? All Row Will be deleted?
    client.put(null, key, new Bin("bin2", "value1")) // set bin2 value to be value1
    client.put(null, key, Bin.asNull("bin2")) // Is that deleted on the commit? any zombie records can be with value1? is it shipped via XDR? is durableDelete change something?
    val record = client.get(null, key)
    println(record)
  }
  1. What put tombstone means? Is it’s shipped via XDR? can it create “zombie records״?
  2. What are the difference between durable delete and non durable delete? Is they shipped between clusters via XDR? i got the durable delete true means that it’s create tombstone, which back me to 1
  3. What’s the difference between put null in specific bin to use bin.asNull and put tombstone? Is they all shipped?

I’m a bit confused,

Thanks! 🙏


Solution

  • A durable delete will create a tombstone, which is a small record that will stay in the system until all previous versions of the record it covers are gone (and some other side conditions). Details on the Durable Delete doc.

    Tombstones prevent 'zombie' records or records resurrection after a cold restart.

    Both durable and non durable deletes are shipped by XDR. There is a different mechanism for non durable deletes, though. Durable deletes (or tombstones) are shipped as any other records.

    Putting null in a specific bin will delete that bin. If it is the last remaining bin in the record, it will delete the record, and the delete will be durable if the durable delete policy is set on the write that nullifies the bin. I don't know the difference between writing null in a bin and using the Bin.asNull. I would expect it to be the same if I had to guess.