首页  

aerospike数据删除机制     所属分类 aerospike 浏览量 1241
Delete record in aerospike

https://discuss.aerospike.com/t/delete-record-in-aerospike/1619
I could not understand why when I delete record and then restart aerospike record come back 
How I can delete it forever?

How is data deleted?
https://discuss.aerospike.com/t/how-is-data-deleted/183

Aerospike 3.10.0 introduces durable deletes 61 for Aerospike Enterprise. 
www.aerospike.com/docs/guide/durable_deletes.html 


Aerospike separates the data into two parts: index and value. 
The index is always stored in DRAM, the value can be stored in either SSD or DRAM (with or without disk for persistence). 
When a record is deleted, the reference to it is removed from the index. 
The actual data is not removed from the disk. 
Another process will find that the data on disk is not being used and reclaim the space.

索引和数据
索引在内存 ,数据在内存或磁盘上
删除 索引上的key
数据没有从磁盘上删除

Note that it is possible for deleted object to reappear. 
For this to happen the following has to occur:

The node must be configured to load data from disk. 
This means that in the file “/etc/aerospike/aerospike.conf” that the variable “cold-start-empty” be set to false for the namespace.

That data has been deleted, but not yet removed from disk. 
(i.e. the index entry has been removed). The node has failed.
The process “asd” has stopped either due to machine failure or the process was killed.

In this case when the node starts, it will read the data from disk and rebuild the index. 
Because the data has not been removed from disk, 
the node will think it is still active and build a new index entry for it. 
So the deleted object will return. 

If you know you will be taking down a node, 
you can prevent deleted data from returning by using the fast restart feature. 
This will hold the index in memory even when the database process has gone down.


Best solution for now: don’t restart aerospike.


节点失败 ,重启 读取数据 重建索引 ,删除的数据可能会再次出现

快速重启模式 ,维持索引在内存中 ,避免删除的数据再次出现



WritePolicy public boolean durableDelete; If the transaction results in a record deletion, leave a tombstone for the record. This prevents deleted records from reappearing after node failures. Valid for Aerospike Server Enterprise Edition 3.10+ only. Default: false (do not tombstone deleted records). 3.10+企业版本才有该功能 WritePolicy policy = new WritePolicy(); policy.durableDelete = true; 社区版 报错 AerospikeException: Error Code 25 测试代码 https://gitee.com/dyyx/asdemo/blob/master/src/main/java/demo/DurableDeleteTest.java
When a durable delete is issued a tombstone is written. The tombstone-write is similar to a record-update in that: It continues to occupy entry in the index, together with other record entries in index. It is persisted on disk, together with previous copies of the record on disk. It has the same meta-data as any other record: last-update-time – just like normal update. generation – increments just like normal update. It is replicated at the same replication factor specified on the namespace. It is migrated the same way current records are migrated. It is conflict resolved the same way as data-records. Tombstones are written as no-expiration. A Tombstone is simply a record without any bins. It contains all meta data, including key. 持久删除 tombstone标记记录 与 记录更新一样 Tombstone 是没有bin的记录 ,包含所有的元数据
Enabling durable-delete in AQL aql> SET DURABLE_DELETE TRUE aql> DELETE FROM ns1.dd WHERE PK = 'key1’ Expired/Deleted data reappears after server is restarted https://discuss.aerospike.com/t/expired-deleted-data-reappears-after-server-is-restarted/470/51 Expired and Evicted Records Expired and evicted records do not generate tombstones. It allows maximum resource capacity to be used for data records instead of tombstones. If resource capacity increases, for example, by increasing the memory capacity on a node, it is possible to revive the non durable deleted record on cold-start. There are also other conditions where evicted records may return: A replica with a shallower cold-start eviction-time than the master. In this case, when the master node departs, and replica is cold started, the replica records may revive. Tombstones do not have an expiration time set, and thus are not eligible to eviction. Tombstones have their own deletion mechanism. 过期和被驱逐的记录不会生成tombstone 将最大的资源容量用于数据记录,而不是tombstone 如果资源容量增加,例如增加节点内存容量,可以在冷启动时恢复非持久删除的记录 还有其他条件,驱逐的记录可能返回: 冷启动驱逐时间比主服务器浅的副本。在这种情况下,当主节点离开时,副本冷启动,副本记录可能会复活。 tombstone没有设置过期时间,因此不符合驱逐条件。 tombstone有自己的删除机制。 Best solution for now: don’t restart aerospike. 避免删除或逐出数据再次出现的最好方法:不要重启AS

上一篇     下一篇
linux iostat 命令

linux sysstat

jvm到底能运行多少个线程

网络IO模型

G1调优建议

检查硬盘是否为SSD