From 50e24d0f48802a689035bf165cfdbbc904d481a8 Mon Sep 17 00:00:00 2001 From: Gregory Burd Date: Tue, 18 Jun 2013 09:21:58 -0400 Subject: [PATCH] Add a longer, multi-table test. Use a release version of WiredTiger from now on. --- c_src/build_deps.sh | 10 +++++----- c_src/wterl.c | 2 +- src/wterl.erl | 37 +++++++++++++++++++++++++++++++++++-- update-version.sh | 5 ++--- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/c_src/build_deps.sh b/c_src/build_deps.sh index 1a64c10..cc0e807 100755 --- a/c_src/build_deps.sh +++ b/c_src/build_deps.sh @@ -11,9 +11,9 @@ unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as w set -e WT_REPO=http://github.com/wiredtiger/wiredtiger.git -WT_BRANCH=develop -WT_VSN="" -WT_DIR=wiredtiger-$WT_BRANCH +WT_BRANCH= +WT_REF="tags/1.6.2" +WT_DIR=wiredtiger-`basename $WT_REF` SNAPPY_VSN="1.0.4" SNAPPY_DIR=snappy-$SNAPPY_VSN @@ -35,9 +35,9 @@ get_wt () if [ -d $BASEDIR/$WT_DIR/.git ]; then (cd $BASEDIR/$WT_DIR && git pull -u) || exit 1 else - if [ "X$WT_VSN" != "X" ]; then + if [ "X$WT_REF" != "X" ]; then git clone ${WT_REPO} && \ - (cd $BASEDIR/wiredtiger && git checkout $WT_VSN || exit 1) + (cd $BASEDIR/wiredtiger && git checkout refs/$WT_REF || exit 1) else git clone ${WT_REPO} && \ (cd $BASEDIR/wiredtiger && git checkout -b $WT_BRANCH origin/$WT_BRANCH || exit 1) diff --git a/c_src/wterl.c b/c_src/wterl.c index cfb5b42..fd1dafd 100644 --- a/c_src/wterl.c +++ b/c_src/wterl.c @@ -127,7 +127,7 @@ __str_hash(uint32_t in, const char *p, size_t len) { uint32_t h = in; for (++p ; len > 0; ++p, --len) - h = (h << 5) - h + (uint32_t)*p; + h += (h << 5) + (h >> 27) + *p; return h; } diff --git a/src/wterl.erl b/src/wterl.erl index f0b26d4..0807ec8 100644 --- a/src/wterl.erl +++ b/src/wterl.erl @@ -96,8 +96,8 @@ nif_stub_error(Line) -> -spec init() -> ok | {error, any()}. init() -> erlang:load_nif(filename:join([priv_dir(), atom_to_list(?MODULE)]), - [{wterl_vsn, "b2c0b65"}, - {wiredtiger_vsn, "1.6.1-87-gbe6742a"}]). + [{wterl_vsn, "53307e8"}, + {wiredtiger_vsn, "1.6.2-0-g07cb0a5"}]). -spec connection_open(string(), config_list()) -> {ok, connection()} | {error, term()}. -spec connection_open(string(), config_list(), config_list()) -> {ok, connection()} | {error, term()}. @@ -586,6 +586,39 @@ insert_delete_test() -> ?assertMatch(not_found, get(ConnRef, "table:test", <<"a">>)), ok = connection_close(ConnRef). +many_open_tables_test_() -> + {timeout, 60, + fun() -> + ConnOpts = [{create,true},{cache_size,"100MB"},{session_max, 8192}], + DataDir = ?TEST_DATA_DIR, + KeyGen = + fun(X) -> + crypto:sha(<>) + end, + ValGen = + fun() -> + crypto:rand_bytes(crypto:rand_uniform(128, 4096)) + end, + TableNameGen = + fun(X) -> + "lsm:" ++ integer_to_list(X) + end, + N = 1000, + ConnRef = open_test_conn(DataDir, ConnOpts), + Parent = self(), + [wterl:create(ConnRef, TableNameGen(X), [{checksum, "uncompressed"}]) || X <- lists:seq(0, 128)], + [spawn(fun() -> + TableName = TableNameGen(X), + [wterl:put(ConnRef, TableName, KeyGen(P), ValGen()) || P <- lists:seq(1, N)], + [wterl:get(ConnRef, TableName, KeyGen(P)) || P <- lists:seq(1, N)], + [wterl:delete(ConnRef, TableName, KeyGen(P)) || P <- lists:seq(1, N)], + Parent ! done + end) || X <- lists:seq(0, 128)], + [wterl:drop(ConnRef, TableNameGen(X)) || X <- lists:seq(0, 128)], + [receive done -> ok end || _ <- lists:seq(0, 128)], + ok = wterl:connection_close(ConnRef) + end}. + init_test_table() -> ConnRef = open_test_conn(?TEST_DATA_DIR), ConnRef = open_test_table(ConnRef), diff --git a/update-version.sh b/update-version.sh index 4d99734..f457d06 100755 --- a/update-version.sh +++ b/update-version.sh @@ -2,10 +2,9 @@ # Note: also, remember to update version numbers in rpath specs so that shared libs can be found at runtime!!! -wterl=`git log -n 1 --pretty=format:"%H"` -wiredtiger0=`(cd c_src/wiredtiger-develop && git log -n 1 --pretty=format:"%H")` +wterl=`git describe --always --long --tags` +wiredtiger0=`(cd c_src/wiredtiger-[0-9.]* && git describe --always --long --tags)` wiredtiger=`echo $wiredtiger0 | awk '{print $2}'` echo $wterl echo $wiredtiger -