Does Aerospike delete the secondary index on a bin if I delete the bin?

deletion
index

#1

I have a bin that I no longer require. My application gradually moves all data from the bin to another bin.

  1. Once the bin is empty, does Aerospike remove the bin from its metadata?
  2. If the answer to 1 is yes, does it also delete any secondary index on it?

#2

Bin metadata is stored on each record - so if you delete a bin in a record, metadata on the bin for that record is absent in the new version of the record. You must explicitly delete the secondary index. BTW, you can delete secondary index on existing bins, before deleting the bins.


#3

Okay. I understand that - Deleting a bin from a record removes bin metadata only from that record. But I guess when the bin has been deleted from all the records, the bin-name is still present in the list of 32k bin names until a cold restart. Am i right?

On secondary indexes:

  1. If i delete a bin from a record, its entry from the secondary index is removed automatically?
  2. If the bin has been deleted from all the records its secondary index would still exist but would be empty?
  3. Deleting a secondary index itself (irrespective of weather the bin has been removed from all the records or not) is possible?

#4

I will answer to the best of my understanding… but you can easily test this on a single node instance. Specifically: "I guess when the bin has been deleted from all the records, the bin-name is still present in the list of 32k bin names until a cold restart. Am i right? "- Not quite - AQL> show bins … the bin name will still be present as used if you had declared a secondary index on that bin and did not delete the secondary index before cold starting the node. So delete the secondary index - AQL> drop index … before cold starting the node.

If i delete a bin from a record, its entry from the secondary index is removed automatically? ==> Yes

If the bin has been deleted from all the records its secondary index would still exist but would be empty? ==> yes, but I would reword as: the secondary index tied to the bin name and data type is still defined with no entries in it

Deleting a secondary index itself (irrespective of weather the bin has been removed from all the records or not) is possible? – Yes, frees up the RAM used by the secondary index tree.


#5

Thanks, I have sufficient info now!


#6

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.