Commit 1ad4b50e authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

added the possibility to track the error reported by REMI

parent b0c8fcc9
......@@ -15,6 +15,12 @@ typedef struct sdskv_client* sdskv_client_t;
typedef struct sdskv_provider_handle *sdskv_provider_handle_t;
#define SDSKV_PROVIDER_HANDLE_NULL ((sdskv_provider_handle_t)NULL)
/**
* @brief Global variable recording the last error encountered by REMI.
*/
extern int32_t sdskv_remi_errno;
/**
* @brief Creates a SDSKV client.
*
......
......@@ -3,6 +3,8 @@
#define MAX_RPC_MESSAGE_SIZE 4000 // in bytes
int32_t sdskv_remi_errno;
struct sdskv_client {
margo_instance_id mid;
......@@ -40,6 +42,7 @@ struct sdskv_provider_handle {
static int sdskv_client_register(sdskv_client_t client, margo_instance_id mid)
{
client->mid = mid;
sdskv_remi_errno = REMI_SUCCESS;
/* check if RPCs have already been registered */
hg_bool_t flag;
......@@ -193,7 +196,7 @@ int sdskv_open(
const char* db_name,
sdskv_database_id_t* db_id)
{
hg_return_t hret;
hg_return_t hreta
int ret;
open_in_t in;
open_out_t out;
......@@ -1494,6 +1497,7 @@ int sdskv_migrate_database(
}
ret = out.ret;
sdskv_remi_errno = out.remi_ret;
margo_free_output(handle, &out);
margo_destroy(handle);
......
......@@ -200,6 +200,7 @@ MERCURY_GEN_PROC(migrate_database_in_t,
((hg_const_string_t)(dest_root)))
MERCURY_GEN_PROC(migrate_database_out_t,
((int32_t)(ret)))
((int32_t)(ret))\
((int32_t)(remi_ret)))
#endif
......@@ -2192,6 +2192,7 @@ static void sdskv_migrate_database_ult(hg_handle_t handle)
dest_addr, in.dest_remi_provider_id, &remi_ph);
if(ret != REMI_SUCCESS) {
out.ret = SDSKV_ERR_REMI;
out.remi_ret = ret;
break;
}
......@@ -2205,6 +2206,7 @@ static void sdskv_migrate_database_ult(hg_handle_t handle)
int status = 0;
ret = remi_fileset_migrate(remi_ph, local_fileset, in.dest_root, in.remove_src, REMI_USE_ABTIO, &status);
if(ret != REMI_SUCCESS) {
out.remi_ret = ret;
if(ret == REMI_ERR_USER)
out.ret = status;
else
......@@ -2213,7 +2215,8 @@ static void sdskv_migrate_database_ult(hg_handle_t handle)
}
if(in.remove_src) {
sdskv_provider_remove_database(svr_ctx, in.source_db_id);
ret = sdskv_provider_remove_database(svr_ctx, in.source_db_id);
out.ret = ret;
#if 0
ABT_rwlock_wrlock(svr_ctx->lock);
/* remove the target from the list of managed targets */
......@@ -2226,7 +2229,6 @@ static void sdskv_migrate_database_ult(hg_handle_t handle)
#endif
}
out.ret = SDSKV_SUCCESS;
} while(false);
remi_fileset_free(local_fileset);
......
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