From d0c587bdec7d23b7049a50cbe1a937257445a8b0 Mon Sep 17 00:00:00 2001 From: Gregory Burd Date: Mon, 5 Dec 2011 12:16:25 -0500 Subject: [PATCH] Various fixes. --- c_src/bdberl_drv.c | 3 +-- c_src/bdberl_tpool.c | 2 +- c_src/configure_bdb.sh | 7 ++++--- src/bdberl.erl | 12 +++++------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/c_src/bdberl_drv.c b/c_src/bdberl_drv.c index 570f53b..721f3e2 100644 --- a/c_src/bdberl_drv.c +++ b/c_src/bdberl_drv.c @@ -321,9 +321,8 @@ DRIVER_INIT(bdberl_drv) // cleanup and set the environment to zero. Attempts to open ports will // fail and the user will have to sort out how to resolve the issue. DBG("G_DB_ENV->close(%p, 0);", &G_DB_ENV); - G_DB_ENV_ERROR = G_DB_ENV->close(G_DB_ENV, 0); + G_DB_ENV->close(G_DB_ENV, 0); G_DB_ENV = 0; - DBG(" = %d\n", G_DB_ENV_ERROR); } } diff --git a/c_src/bdberl_tpool.c b/c_src/bdberl_tpool.c index 4f4f3a0..22a1535 100644 --- a/c_src/bdberl_tpool.c +++ b/c_src/bdberl_tpool.c @@ -378,7 +378,7 @@ void bdberl_tpool_thread_id(DB_ENV *env, pid_t *pid, db_threadid_t *tid) char *bdberl_tpool_thread_id_string(DB_ENV *dbenv, pid_t pid, db_threadid_t tid, char *buf) { - snprintf(buf, DB_THREADID_STRLEN, "%d/%p", pid, tid); + snprintf(buf, DB_THREADID_STRLEN, "%d/%p", (unsigned int)pid, (void *)tid); return buf; } diff --git a/c_src/configure_bdb.sh b/c_src/configure_bdb.sh index 40cb38f..ba1f075 100755 --- a/c_src/configure_bdb.sh +++ b/c_src/configure_bdb.sh @@ -2,7 +2,8 @@ cd $1/build_unix && \ ../dist/configure --disable-shared --enable-static --with-pic \ - --disable-heap --disable-queue \ - --disable-partition --disable-replication \ - --enable-o_direct \ + --disable-heap --disable-queue --disable-replication \ + --enable-o_direct --enable-o_direct \ + --enable-debug --enable-diagnostics \ + --enable-dtrace \ --prefix=$2 diff --git a/src/bdberl.erl b/src/bdberl.erl index 50cd7b7..3319ca0 100644 --- a/src/bdberl.erl +++ b/src/bdberl.erl @@ -105,7 +105,7 @@ %% @spec open(Name, Type) -> {ok, Db} | {error, Error} %% where %% Name = string() -%% Type = btree | hash +%% Type = btree | hash | queue %% Db = integer() %% %% @equiv open(Name, Type, [create]) @@ -273,7 +273,7 @@ close(Db, Opts) -> -spec txn_begin() -> ok | db_error(). txn_begin() -> - txn_begin([txn_snapshot]). + txn_begin([]). %%-------------------------------------------------------------------- @@ -596,7 +596,7 @@ transaction(Fun, Retries, TimeLeft, Opts) -> transaction(Fun, R, T, Opts); _ : Reason -> - lager:info("function threw non-lock error - ~p", [Reason]), + lager:info("function threw non-lock error - ~p", [{Reason, erlang:get_stacktrace()}]), ok = txn_abort(), {error, {transaction_failed, Reason}} end; @@ -834,7 +834,7 @@ put_commit_r(Db, Key, Value, Opts) -> %% @end %%-------------------------------------------------------------------- -spec get(Db :: db(), Key :: db_key()) -> - not_found | {ok, db_ret_value()} | db_error(). + not_found | {ok, db_ret_value()} | {error, db_error()}. get(Db, Key) -> get(Db, Key, []). @@ -885,7 +885,7 @@ get(Db, Key) -> %% @end %%-------------------------------------------------------------------- -spec get(Db :: db(), Key :: db_key(), Opts :: db_flags()) -> - not_found | {ok, db_ret_value()} | db_error(). + not_found | {ok, db_ret_value()} | {error, db_error()}. get(Db, Key, Opts) -> {KeyLen, KeyBin} = to_binary(Key), @@ -964,8 +964,6 @@ get_r(Db, Key, Opts) -> end. - - %%-------------------------------------------------------------------- %% @doc %% Delete a value based on key.