I am working on Aerospike python client. I am inserting data into the cluster using aerospike loader. Now I need to see whether the records were stored on the cluster successfully.
The command being used:
command = 'java -cp /aerospike-loader/aerospike-load-2.2-jar-with-dependencies.jar ' \
'-Dlog4j.configuration=file:/aerospike-loader/log4j.properties ' \
'com.aerospike.load.AerospikeLoad -h %s -p %d -n %s -c %s %s'
command_str = command % (self.host, self.port, self.namespace, tmp_json_file.name, data_file_path)
the file tmp_json_file
contains config file content exactly similar to this: https://www.aerospike.com/docs/tools/asloader/examples.html
Now how do I check whether the data was transferred successfully? I tried using client.exists(key)
, but the meta
field returns None
as writePolicy=true
was not set. How to set that using python client any example? Or any other way to check that the records were successfully inserted?
You can extract all the keys from the JSON and for each assemble a tuple of (namespace, json-set, json-key)
(I mean using the set
and key
fields of the each JSON object). You can then make use of aerospike.Client.exists_many
to verify the existence of the keys using batch read operations.
Even if you didn't store the human-readable key (that's the default behavior and you probably don't want to spend the extra storage), each record has a unique 20B digest. That digest is created in the client by hashing the set and primary key part of the 3-tuple mentioned above. When you'll check for existence the client will once again hash those keys you gave it, getting the same digests, and check on their existence.