Commit e4c9fdd1 authored by Matthieu Dorier's avatar Matthieu Dorier

fixed bug with sdskv_get_packed

parent 7bd2df58
......@@ -1183,6 +1183,7 @@ static void sdskv_get_packed_ult(hg_handle_t handle)
get_packed_in_t in;
get_packed_out_t out;
out.ret = SDSKV_SUCCESS;
out.num_keys = 0;
std::vector<char> local_keys_buffer;
std::vector<char> local_vals_buffer;
hg_bulk_t local_keys_bulk_handle;
......@@ -1282,14 +1283,15 @@ static void sdskv_get_packed_ult(hg_handle_t handle)
out.ret = SDSKV_ERR_SIZE;
val_sizes[i] = 0;
} else {
out.num_keys += 1;
val_sizes[i] = vdata.size();
memcpy(packed_values, vdata.data(), val_sizes[i]);
packed_values += val_sizes[i];
}
} else {
val_sizes[i] = 0;
val_sizes[i] = (hg_size_t)(-1);
}
packed_keys += key_sizes[i];
packed_values += val_sizes[i];
}
/* do a PUSH operation to push back the values to the client */
......
......@@ -173,6 +173,15 @@ int main(int argc, char *argv[])
ret = sdskv_get_packed(kvph, db_id, &num_keys_read,
packed_keys.data(), packed_key_sizes.data(),
total_read_size, read_values.data(), read_value_sizes.data());
if(num_keys_read != num_keys) {
fprintf(stderr, "Error: sdskv_get_packed didn't read all the requested keys\n");
sdskv_shutdown_service(kvcl, svr_addr);
sdskv_provider_handle_release(kvph);
margo_addr_free(mid, svr_addr);
sdskv_client_finalize(kvcl);
margo_finalize(mid);
return -1;
}
if(ret != 0) {
fprintf(stderr, "Error: sdskv_get_packed() failed\n");
sdskv_shutdown_service(kvcl, svr_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment