Commit caa5d919 authored by Matthieu Dorier's avatar Matthieu Dorier
Browse files

corrected bug where BDB and LDB are interverted in datastore factory

parent c954c5a3
...@@ -11,9 +11,10 @@ bin_PROGRAMS = bin/sdskv-server-daemon \ ...@@ -11,9 +11,10 @@ bin_PROGRAMS = bin/sdskv-server-daemon \
test/sdskv-put-test \ test/sdskv-put-test \
test/sdskv-length-test \ test/sdskv-length-test \
test/sdskv-get-test \ test/sdskv-get-test \
test/sdskv-list-keys-test \ test/sdskv-erase-test \
test/sdskv-list-keyvals-test \ test/sdskv-list-keys-test
test/sdskv-erase-test
#test/sdskv-list-keyvals-test
bin_sdskv_server_daemon_SOURCES = src/sdskv-server-daemon.c bin_sdskv_server_daemon_SOURCES = src/sdskv-server-daemon.c
bin_sdskv_server_daemon_DEPENDENCIES = lib/libsdskv-server.la bin_sdskv_server_daemon_DEPENDENCIES = lib/libsdskv-server.la
...@@ -94,9 +95,10 @@ TESTS = test/basic.sh \ ...@@ -94,9 +95,10 @@ TESTS = test/basic.sh \
test/put-test.sh \ test/put-test.sh \
test/length-test.sh \ test/length-test.sh \
test/get-test.sh \ test/get-test.sh \
test/list-keys-test.sh \ test/erase-test.sh \
test/list-keyvals-test.sh \ test/list-keys-test.sh
test/erase-test.sh
# test/list-keyvals-test.sh
TESTS_ENVIRONMENT = TIMEOUT="$(TIMEOUT)" \ TESTS_ENVIRONMENT = TIMEOUT="$(TIMEOUT)" \
MKTEMP="$(MKTEMP)" MKTEMP="$(MKTEMP)"
...@@ -121,9 +123,9 @@ test_sdskv_list_keys_test_SOURCES = test/sdskv-list-keys-test.cc ...@@ -121,9 +123,9 @@ test_sdskv_list_keys_test_SOURCES = test/sdskv-list-keys-test.cc
test_sdskv_list_keys_test_DEPENDENCIES = lib/libsdskv-client.la test_sdskv_list_keys_test_DEPENDENCIES = lib/libsdskv-client.la
test_sdskv_list_keys_test_LDFLAGS = -Llib -lsdskv-client test_sdskv_list_keys_test_LDFLAGS = -Llib -lsdskv-client
test_sdskv_list_keyvals_test_SOURCES = test/sdskv-list-kv-test.cc #test_sdskv_list_keyvals_test_SOURCES = test/sdskv-list-kv-test.cc
test_sdskv_list_keyvals_test_DEPENDENCIES = lib/libsdskv-client.la #test_sdskv_list_keyvals_test_DEPENDENCIES = lib/libsdskv-client.la
test_sdskv_list_keyvals_test_LDFLAGS = -Llib -lsdskv-client #test_sdskv_list_keyvals_test_LDFLAGS = -Llib -lsdskv-client
test_sdskv_erase_test_SOURCES = test/sdskv-erase-test.cc test_sdskv_erase_test_SOURCES = test/sdskv-erase-test.cc
test_sdskv_erase_test_DEPENDENCIES = lib/libsdskv-client.la test_sdskv_erase_test_DEPENDENCIES = lib/libsdskv-client.la
......
...@@ -75,9 +75,9 @@ class datastore_factory { ...@@ -75,9 +75,9 @@ class datastore_factory {
case KVDB_BWTREE: case KVDB_BWTREE:
return create_bwtree_datastore(name); return create_bwtree_datastore(name);
case KVDB_LEVELDB: case KVDB_LEVELDB:
return create_berkeleydb_datastore(name);
case KVDB_BERKELEYDB:
return create_leveldb_datastore(name); return create_leveldb_datastore(name);
case KVDB_BERKELEYDB:
return create_berkeleydb_datastore(name);
} }
return nullptr; return nullptr;
}; };
......
...@@ -64,9 +64,9 @@ static int sdskv_client_register(sdskv_client_t client, margo_instance_id mid) ...@@ -64,9 +64,9 @@ static int sdskv_client_register(sdskv_client_t client, margo_instance_id mid)
client->sdskv_open_id = client->sdskv_open_id =
MARGO_REGISTER(mid, "sdskv_open_rpc", open_in_t, open_out_t, NULL); MARGO_REGISTER(mid, "sdskv_open_rpc", open_in_t, open_out_t, NULL);
client->sdskv_list_keys_id = client->sdskv_list_keys_id =
MARGO_REGISTER(mid, "sdskv_list_keys_rpc", list_in_t, list_out_t, NULL); MARGO_REGISTER(mid, "sdskv_list_keys_rpc", list_keys_in_t, list_keys_out_t, NULL);
client->sdskv_list_keyvals_id = //client->sdskv_list_keyvals_id =
MARGO_REGISTER(mid, "sdskv_list_keyvals_rpc", list_in_t, list_out_t, NULL); // MARGO_REGISTER(mid, "sdskv_list_keyvals_rpc", list_in_t, list_out_t, NULL);
} }
return 0; return 0;
...@@ -542,8 +542,8 @@ int sdskv_list_keys(sdskv_provider_handle_t provider, ...@@ -542,8 +542,8 @@ int sdskv_list_keys(sdskv_provider_handle_t provider,
// keys for each key // keys for each key
hg_size_t* max_keys) // maximum number of keys requested hg_size_t* max_keys) // maximum number of keys requested
{ {
list_in_t in; list_keys_in_t in;
list_out_t out; list_keys_out_t out;
hg_return_t hret = HG_SUCCESS; hg_return_t hret = HG_SUCCESS;
hg_handle_t handle; hg_handle_t handle;
int ret; int ret;
...@@ -593,7 +593,7 @@ int sdskv_list_keys(sdskv_provider_handle_t provider, ...@@ -593,7 +593,7 @@ int sdskv_list_keys(sdskv_provider_handle_t provider,
return ret; return ret;
} }
#if 0
int sdskv_list_keyvals( int sdskv_list_keyvals(
sdskv_provider_handle_t provider, sdskv_provider_handle_t provider,
sdskv_database_id_t db_id, sdskv_database_id_t db_id,
...@@ -669,7 +669,7 @@ int sdskv_list_keyvals( ...@@ -669,7 +669,7 @@ int sdskv_list_keyvals(
return ret; return ret;
} }
#endif
int sdskv_shutdown_service(sdskv_client_t client, hg_addr_t addr) int sdskv_shutdown_service(sdskv_client_t client, hg_addr_t addr)
{ {
return margo_shutdown_remote_instance(client->mid, addr); return margo_shutdown_remote_instance(client->mid, addr);
......
...@@ -235,7 +235,7 @@ typedef struct { ...@@ -235,7 +235,7 @@ typedef struct {
kv_data_t start_key; kv_data_t start_key;
hg_size_t start_ksize; hg_size_t start_ksize;
hg_size_t max_keys; hg_size_t max_keys;
} list_in_t; } list_keys_in_t;
typedef struct { typedef struct {
hg_size_t nkeys; hg_size_t nkeys;
...@@ -245,12 +245,12 @@ typedef struct { ...@@ -245,12 +245,12 @@ typedef struct {
kv_data_t *values; kv_data_t *values;
hg_size_t *vsizes; hg_size_t *vsizes;
int32_t ret; int32_t ret;
} list_out_t; } list_keys_out_t;
static inline hg_return_t hg_proc_list_in_t(hg_proc_t proc, void *data) static inline hg_return_t hg_proc_list_keys_in_t(hg_proc_t proc, void *data)
{ {
hg_return_t ret; hg_return_t ret;
list_in_t *in = (list_in_t*)data; list_keys_in_t *in = (list_keys_in_t*)data;
ret = hg_proc_uint64_t(proc, &in->db_id); ret = hg_proc_uint64_t(proc, &in->db_id);
if(ret != HG_SUCCESS) return ret; if(ret != HG_SUCCESS) return ret;
...@@ -278,11 +278,11 @@ static inline hg_return_t hg_proc_list_in_t(hg_proc_t proc, void *data) ...@@ -278,11 +278,11 @@ static inline hg_return_t hg_proc_list_in_t(hg_proc_t proc, void *data)
return ret; return ret;
} }
static inline hg_return_t hg_proc_list_out_t(hg_proc_t proc, void *data) static inline hg_return_t hg_proc_list_keys_out_t(hg_proc_t proc, void *data)
{ {
hg_return_t ret; hg_return_t ret;
unsigned int i; unsigned int i;
list_out_t *out = (list_out_t*)data; list_keys_out_t *out = (list_keys_out_t*)data;
/* encode/decode the number of keys */ /* encode/decode the number of keys */
ret = hg_proc_hg_size_t(proc, &out->nkeys); ret = hg_proc_hg_size_t(proc, &out->nkeys);
if(ret != HG_SUCCESS) return ret; if(ret != HG_SUCCESS) return ret;
...@@ -293,7 +293,6 @@ static inline hg_return_t hg_proc_list_out_t(hg_proc_t proc, void *data) ...@@ -293,7 +293,6 @@ static inline hg_return_t hg_proc_list_out_t(hg_proc_t proc, void *data)
switch(hg_proc_get_op(proc)) { switch(hg_proc_get_op(proc)) {
case HG_ENCODE: case HG_ENCODE:
fprintf(stderr,"In HG_ENCODE out->nkeys = %ld\n", out->nkeys);
/* encode the size of each key */ /* encode the size of each key */
for (i=0; i<out->nkeys; i++) { for (i=0; i<out->nkeys; i++) {
ret = hg_proc_hg_size_t(proc, &(out->ksizes[i])); ret = hg_proc_hg_size_t(proc, &(out->ksizes[i]));
...@@ -307,7 +306,6 @@ static inline hg_return_t hg_proc_list_out_t(hg_proc_t proc, void *data) ...@@ -307,7 +306,6 @@ static inline hg_return_t hg_proc_list_out_t(hg_proc_t proc, void *data)
break; break;
case HG_DECODE: case HG_DECODE:
fprintf(stderr,"In HG_DECODE out->nkeys = %ld\n", out->nkeys);
if(out->nkeys) { if(out->nkeys) {
/* decode the size of each key */ /* decode the size of each key */
out->ksizes = (hg_size_t*)malloc(out->nkeys*sizeof(*out->ksizes)); out->ksizes = (hg_size_t*)malloc(out->nkeys*sizeof(*out->ksizes));
......
...@@ -82,13 +82,13 @@ extern "C" int sdskv_provider_register( ...@@ -82,13 +82,13 @@ extern "C" int sdskv_provider_register(
sdskv_open_ult, mplex_id, abt_pool); sdskv_open_ult, mplex_id, abt_pool);
margo_register_data_mplex(mid, rpc_id, mplex_id, (void*)tmp_svr_ctx, NULL); margo_register_data_mplex(mid, rpc_id, mplex_id, (void*)tmp_svr_ctx, NULL);
rpc_id = MARGO_REGISTER_MPLEX(mid, "sdskv_list_keys_rpc", rpc_id = MARGO_REGISTER_MPLEX(mid, "sdskv_list_keys_rpc",
list_in_t, list_out_t, list_keys_in_t, list_keys_out_t,
sdskv_list_keys_ult, mplex_id, abt_pool); sdskv_list_keys_ult, mplex_id, abt_pool);
margo_register_data_mplex(mid, rpc_id, mplex_id, (void*)tmp_svr_ctx, NULL); margo_register_data_mplex(mid, rpc_id, mplex_id, (void*)tmp_svr_ctx, NULL);
rpc_id = MARGO_REGISTER_MPLEX(mid, "sdskv_list_keyvals_rpc", // rpc_id = MARGO_REGISTER_MPLEX(mid, "sdskv_list_keyvals_rpc",
list_in_t, list_out_t, // list_in_t, list_out_t,
sdskv_list_keyvals_ult, mplex_id, abt_pool); // sdskv_list_keyvals_ult, mplex_id, abt_pool);
margo_register_data_mplex(mid, rpc_id, mplex_id, (void*)tmp_svr_ctx, NULL); // margo_register_data_mplex(mid, rpc_id, mplex_id, (void*)tmp_svr_ctx, NULL);
rpc_id = MARGO_REGISTER_MPLEX(mid, "sdskv_erase_rpc", rpc_id = MARGO_REGISTER_MPLEX(mid, "sdskv_erase_rpc",
erase_in_t, erase_out_t, erase_in_t, erase_out_t,
sdskv_erase_ult, mplex_id, abt_pool); sdskv_erase_ult, mplex_id, abt_pool);
...@@ -619,8 +619,8 @@ static void sdskv_list_keys_ult(hg_handle_t handle) ...@@ -619,8 +619,8 @@ static void sdskv_list_keys_ult(hg_handle_t handle)
{ {
hg_return_t hret; hg_return_t hret;
list_in_t in; list_keys_in_t in;
list_out_t out; list_keys_out_t out;
out.ret = -1; out.ret = -1;
out.nkeys = 0; out.nkeys = 0;
...@@ -682,6 +682,7 @@ static void sdskv_list_keys_ult(hg_handle_t handle) ...@@ -682,6 +682,7 @@ static void sdskv_list_keys_ult(hg_handle_t handle)
} }
DEFINE_MARGO_RPC_HANDLER(sdskv_list_keys_ult) DEFINE_MARGO_RPC_HANDLER(sdskv_list_keys_ult)
#if 0
static void sdskv_list_keyvals_ult(hg_handle_t handle) static void sdskv_list_keyvals_ult(hg_handle_t handle)
{ {
...@@ -762,6 +763,7 @@ static void sdskv_list_keyvals_ult(hg_handle_t handle) ...@@ -762,6 +763,7 @@ static void sdskv_list_keyvals_ult(hg_handle_t handle)
return; return;
} }
DEFINE_MARGO_RPC_HANDLER(sdskv_list_keyvals_ult) DEFINE_MARGO_RPC_HANDLER(sdskv_list_keyvals_ult)
#endif
static void sdskv_server_finalize_cb(void *data) static void sdskv_server_finalize_cb(void *data)
{ {
......
...@@ -8,7 +8,7 @@ source $srcdir/test/test-util.sh ...@@ -8,7 +8,7 @@ source $srcdir/test/test-util.sh
# start a server with 2 second wait, # start a server with 2 second wait,
# 20s timeout, and my_test_db as database # 20s timeout, and my_test_db as database
test_start_server 2 20 my_test_db test_start_server 2 20 my_test_db:ldb
sleep 1 sleep 1
......
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