Using Python (2 or 3 doesn’t change anything), I unable to “get” the primary key which was used for “put”. I started to see the problem when I decided to scan a ‘set’ and found all primary-keys set to ‘None’. I initially thought it was my fault, but I managed to reproduce the problem with the “standard” Python example. Here is part of the code :
…
Records are addressable via a tuple of (namespace, set, key)
By default the key portion of the key tuple is not saved, because it would cost extra in storage space. The key write policy controls this behavior, and you can modify it when you call aerospike.Client.put. Look at the example provided in the doc for that method.
I tried to use ‘DIGEST’ key attributes, describes in : http://www.aerospike.com/docs/guide/policies.html, since it’s what’s recommended : “DIGEST—Calculate (on the client) and send the digest value of key to the server. We recommend using this mode of operation.”
However, it has no effect… Besides, while I perfectly understand the technical reason behind this strategy, I have the feeling that the documentation is not very clear about it. Like…
Though, if it’s stored in DRAM, why is that I don’t have it with a client.get() I had the false impression that indexes could be accessed any way…
Anyway, it finally worked using the SEND policy, but I still don’t understand the subtle difference between DIGEST and SEND regarding key storage… besides the ‘digest’ itself.
Sorry, I should have been more explicit. aerospike.KEY_DIGEST is the default (‘just the digest’) and aerospike.KEY_SEND is the optional alternative value, which means store the key along with the bin data.
In both the primary index and secondary index the metadata is stored in DRAM, regardless of what storage device you have for the data, but the key, like bins, are stored as data (not in the index).