From 72448d2b54bec09337f665f3b56bd9c8e19ce12e Mon Sep 17 00:00:00 2001 From: Gregory Burd Date: Wed, 17 Jul 2013 16:34:10 -0400 Subject: [PATCH] Merge remote-tracking branch 'origin/master' into gsb-atomic-ops --- c_src/async_nif.h | 10 ++++------ c_src/build_deps.sh | 2 +- src/riak_kv_wterl_backend.erl | 34 ++++++++++++++++++++-------------- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/c_src/async_nif.h b/c_src/async_nif.h index 92ebe66..b62f9f2 100644 --- a/c_src/async_nif.h +++ b/c_src/async_nif.h @@ -337,11 +337,9 @@ async_nif_enqueue_req(struct async_nif_state* async_nif, struct async_nif_req_en } /* If the for loop finished then we didn't find a suitable queue for this - request, meaning we're backed up so trigger eagain. */ - if (i == async_nif->num_queues) { - enif_mutex_unlock(q->reqs_mutex); - return 0; - } + request, meaning we're backed up so trigger eagain. Note that if we left + the loop in this way we hold no lock. */ + if (i == async_nif->num_queues) return 0; /* Add the request to the queue. */ STAILQ_INSERT_TAIL(&q->reqs, req, entries); @@ -349,7 +347,7 @@ async_nif_enqueue_req(struct async_nif_state* async_nif, struct async_nif_req_en /* We've selected a queue for this new request now check to make sure there are enough workers actively processing requests on this queue. */ - if (q->depth > q->num_workers) + if (q->depth > q->num_workers || q->num_workers == 0) if (async_nif_start_worker(async_nif, q) == 0) q->num_workers++; /* Build the term before releasing the lock so as not to race on the use of diff --git a/c_src/build_deps.sh b/c_src/build_deps.sh index 15608ef..324350e 100755 --- a/c_src/build_deps.sh +++ b/c_src/build_deps.sh @@ -12,7 +12,7 @@ set -e WT_REPO=http://github.com/wiredtiger/wiredtiger.git WT_BRANCH= -WT_REF="tags/1.6.2" +WT_REF="tags/1.6.3" WT_DIR=wiredtiger-`basename $WT_REF` SNAPPY_VSN="1.0.4" diff --git a/src/riak_kv_wterl_backend.erl b/src/riak_kv_wterl_backend.erl index 94cf8bb..0d9aa51 100644 --- a/src/riak_kv_wterl_backend.erl +++ b/src/riak_kv_wterl_backend.erl @@ -109,23 +109,23 @@ start(Partition, Config) -> Compressor = case wterl:config_value(block_compressor, Config, "snappy") of {block_compressor, "snappy"}=C -> [C]; - {block_compressor, "none"} -> []; - {block_compressor, none} -> []; - {block_compressor, _} -> [{block_compressor, "snappy"}]; - _ -> [{block_compressor, "snappy"}] + {block_compressor, "none"} -> []; + {block_compressor, none} -> []; + {block_compressor, _} -> [{block_compressor, "snappy"}]; + _ -> [{block_compressor, "snappy"}] end, TableOpts = case Type of "lsm" -> [{internal_page_max, "128K"}, - {leaf_page_max, "128K"}, + {leaf_page_max, "16K"}, {lsm_chunk_size, "100MB"}, {lsm_merge_threads, 2}, - {prefix_compression, false}, + {prefix_compression, true}, {lsm_bloom_newest, true}, {lsm_bloom_oldest, true} , - {lsm_bloom_bit_count, 128}, - {lsm_bloom_hash_count, 64}, + {lsm_bloom_bit_count, 28}, + {lsm_bloom_hash_count, 19}, {lsm_bloom_config, [{leaf_page_max, "8MB"}]} ] ++ Compressor; "table" -> @@ -375,10 +375,17 @@ max_sessions(Config) -> undefined -> 1024; Size -> Size end, - Est = 100 * (RingSize * erlang:system_info(schedulers)), % TODO: review/fix this logic - case Est > 1000000000 of % Note: WiredTiger uses a signed int for this - true -> 1000000000; - false -> Est + Est = RingSize * erlang:system_info(schedulers), + case Est > 8192 of + true -> + 8192; + false -> + case Est < 1024 of + true -> + 1024; + false -> + Est + end end. %% @private @@ -406,7 +413,6 @@ establish_connection(Config, Type) -> [ wterl:config_value(create, Config, true), wterl:config_value(sync, Config, false), wterl:config_value(logging, Config, true), - wterl:config_value(transactional, Config, true), wterl:config_value(session_max, Config, max_sessions(Config)), wterl:config_value(cache_size, Config, size_cache(RequestedCacheSize)), wterl:config_value(statistics_log, Config, [{wait, 300}]), % sec @@ -562,7 +568,7 @@ size_cache(RequestedSize) -> TotalRAM = proplists:get_value(system_total_memory, Memory), FreeRAM = proplists:get_value(free_memory, Memory), UsedByBeam = proplists:get_value(total, erlang:memory()), - Target = ((TotalRAM - UsedByBeam) div 4), + Target = ((TotalRAM - UsedByBeam) div 3), FirstGuess = (Target - (Target rem (1024 * 1024))), SecondGuess = case FirstGuess > FreeRAM of