Hi Liu_Ld,
I was trying to reproduce the digest issue using c client. I am able to get same digest both in asbackup and encoding original digest. So if I am not missing, As there is no direct API to calculate original digest, Can you point me out which API you have used for calculating original digest?
Following piece of code I have used. I am getting same digest as in backup file. Please let me know if your digest creation and encoding is different from this.
I hope cf_b64.h helps you in proper encoding. That includes standard base64 encoding logic. Thanks for suggestion. Usually we recommend to use CSV loader for moving data from other nosql databases into aerospike.
CSV formatted data dumps are more common. CSV loader is generic and can be useful both in 1st and 2nd situations you have mentioned. Aerospike data dump is different then CSV and only used by aerospike db. We may merge these tools in future.
Aerospike uses key and set name to generate unique digest, So it stores only digest. If your application is doing some operation after getting the list of keys of a set then you can do the same operation using digests.
But if you really want to use keys later then you can keep the key as metadata part of record using following way:
While inserting one record if you set writePolicy.sendKey = true then key will be stored as metadata part of a record.
You can use Scan API to get all records of a set. To get only metadata specify nobins=true in scan policy. Please find below code snippet for reference:
public void scanExample(AerospikeClient client, Parameters params) throws Exception {
ScanPolicy policy = new ScanPolicy();
policy.includeBinData = false;
client.scanAll(policy, "test", "demoset", this);
System.out.println("key list:" + keyList.toString());
System.out.println("digest list:" + digestList.toString());
}
public void scanCallback(Key key, Record record) {
digestList.add(key.digest);
//if user key stored
keyList.add(key.userKey);
}