I tested this and realized this is not the case. I added 30,000 records to a set.
- then deleted 10k of them
- set a ttl of 10 secs and deleted the next 10k
- set a ttl of 10 secs for the other 10k
Before restart i did a get on all of them they gave expected results
Then i made a aerospike restart. And almost all of them came back.
This is the code I used.
# import the module
import aerospike
# Configure the client
config = {
'hosts': [('127.0.0.1', 3000)]
}
# Create a client and connect it to the cluster
client = aerospike.client(config).connect()
# Records are addressable via a tuple of (namespace, set, key)
set_name = 'tp2'
def putDelete():
policy = {'key': aerospike.POLICY_KEY_SEND} # store the key along with the record
meta = {'ttl': 0}
# client.put(key, bins, meta, policy)
# bins = {'name': 'John Doe','age': 33}
# client.put(key, bins)
#
for i in xrange(3 * (10 ** 4)):
key = ('ssd', set_name, str(i))
bins = {'age': i}
client.put(key, bins, meta, policy)
if i % 10 ** 3 == 0:
print client.get(key)[1:]
print "==========="
# Read a record
key = ('ssd', set_name, '100')
(key, metadata, record) = client.get(key)
print (key, metadata, record)
# Close the connection to the Aerospike cluster
for i in xrange(10 ** 4):
key = ('ssd', set_name, str(i))
client.remove(key)
if i % 10 ** 3 == 0:
print client.get(key)[1:]
print "==========="
for i in xrange(10 ** 4, 2 * (10 ** 4)):
key = ('ssd', set_name, str(i))
meta = {'ttl': 10}
bins = {}
client.put(key, bins, meta)
client.remove(key)
if i % 10 ** 3 == 0:
print client.get(key)[1:]
print "==========="
for i in xrange(2 * (10 ** 4), 3 * (10 ** 4)):
key = ('ssd', set_name, str(i))
meta = {'ttl': 10}
bins = {}
client.put(key, bins, meta)
if i % 10 ** 3 == 0:
print client.get(key)[1:]
print "==========="
def read():
for i in xrange(10 ** 4):
key = ('ssd', set_name, str(i))
if i % 10 ** 3 == 0:
print client.get(key)[1:], key
print "==========="
for i in xrange(10 ** 4, 2 * (10 ** 4)):
key = ('ssd', set_name, str(i))
if i % 10 ** 3 == 0:
print client.get(key)[1:], key
print "==========="
for i in xrange(2 * (10 ** 4), 3 * (10 ** 4)):
key = ('ssd', set_name, str(i))
if i % 10 ** 3 == 0:
print client.get(key)[1:], key
print "==========="
# putDelete()
read()
client.close()