Hi there,
I have a set which the key is 16-byte binary data. The code I used to insert the data is as follows:
as_key key;
uint64_t keyval[2];
keyval[0] = i;
keyval[1] = i;
as_key_init_raw(&key, g_namespace, k_set, (uint8_t*)(keyval), 16);
as_record rec;
as_record_inita(&rec, 1);
as_record_set_int64(&rec, "kbin1", (uint64_t)i);
// Write a record to the database.
if (aerospike_key_put(p_as, &err, NULL, &key, &rec) != AEROSPIKE_OK) {
LOG("aerospike_key_put() returned %d - %s", err.code, err.message);
return false;
I was able to verify after the insert, the records are good and key return from
if (aerospike_key_get(&as, &err, NULL, &key, &p_rec) != AEROSPIKE_OK) {}
uint8_t* keys = as_bytes_get((as_bytes*) (key.valuep));
is what I inserted.
Then when I do the aerospike_batch_get, I can see it got same number of records back, but each record.result is AEROSPIKE_ERR_RECORD_NOT_FOUND. The batch code is as follows:
as_batch batch; as_batch_init(&batch, g_n_keys);
for (uint32_t i = 0; i < g_n_keys; i++) {
uint64_t keyval[2];
keyval[0] = i;
keyval[1] = i;
as_key_init_raw(as_batch_keyat(&batch, i), g_namespace, k_set, (uint8_t*)(keyval), 16);
}
// Get all of these keys - they should all be there.
if (aerospike_batch_get(&as, &err, NULL, &batch, batch_read_cb, NULL) !=
AEROSPIKE_OK) {
LOG("aerospike_batch_get() returned %d - %s", err.code, err.message);
cleanup(&as);
exit(-1);
}
Anything wrong with the code?
Thanks,
Mark
I }