I'm using the following method from Java Aerospike client in order to delete records/bins:
def truncate(startTime: Long, durableDelete: Boolean): List[AtomicInteger] = {
logger.info(s"truncate($startTime) Triggered")
val calendar = new GregorianCalendar()
calendar.setTimeInMillis(startTime)
// Define Scan and Write Policies
val scanPolicy = new ScanPolicy()
scanPolicy.filterExp = Exp.build(Exp.le(Exp.lastUpdate(), Exp.`val`(calendar)))
val writePolicy = client.writePolicyDefault
writePolicy.durableDelete = durableDelete
// Scan all records such as LUT <= startTime
for (recoverBins <- config.binsToRecover) yield {
val recordCount = new AtomicInteger(0)
client.scanAll(scanPolicy, recoverBins.namespace, recoverBins.set, new ScanCallback() {
override def scanCallback(key: Key, record: Record): Unit = {
recoverBins.specificBins match {
// multi-bin scenario
case Some(specificBins) =>
specificBins foreach (bin => client.put(writePolicy, key, Bin.asNull(bin)))
logger.debug(s"Bins $specificBins of record: $record with key: $key are set to NULL")
// single-bin scenario
case None =>
client.delete(writePolicy, key)
logger.debug(s"Record: $record with key: $key DELETED")
}
recordCount.incrementAndGet()
}
})
duruableDelete is set to true
The problem is that when I'm removing bins (Bin.asNull) i can see the results immediately but when checking the "deleted" key i can still see them (aql> select * from ns.set where PK = <ShouldBeDeleted>
any ideas why? what I'm doing wrong?
Another question: How does duruableDelete is preventing "Zombie records"? what happening behind the scene?
Thanks!