Compare commits

..

12 commits

Author SHA1 Message Date
Gregory Burd
cc807a97d6 Add new mmap config option. 2014-01-15 10:45:04 -05:00
Gregory Burd
ea99493ea3 Compenstate for LSM config API changes 2013-12-09 12:54:58 -05:00
Gregory Burd
08b2d18463 Fix checkpoint config. 2013-11-20 13:10:28 -05:00
Gregory Burd
3302ab26ed Use the develop branch for now. 2013-11-19 14:16:26 -05:00
Gregory Burd
db2daf99b2 Default logging off. 2013-11-19 14:16:01 -05:00
Gregory Burd
68d9ed942b Update to WiredTiger 1.6.6 2013-11-18 20:54:59 -05:00
Gregory Burd
36faa4e713 Forgot to remove second use of checkpoint setting. 2013-11-18 20:50:26 -05:00
Gregory Burd
e560185420 When logging enable checkpoints, even when using LSM. 2013-11-18 20:46:22 -05:00
Gregory Burd
448c0b555c Update config to match latest available options. 2013-10-30 15:00:41 -04:00
Gregory Burd
634bcd188a Integrate new configuration options available in WiredTiger. 2013-10-30 14:50:14 -04:00
Gregory Burd
1664fdcf8c API for handlers in WiredTiger changed to include session state, update our use of the API to match that change. 2013-10-30 13:11:14 -04:00
Gregory Burd
95515f111c Merge pull request #11 from basho-labs/gsb-2.0-fixes
Changes related to Riak 2.0 and an issue with how statistics were gathered from the backend
2013-10-30 08:53:49 -07:00
5 changed files with 59 additions and 30 deletions

View file

@ -13,7 +13,7 @@ set -e
WT_REPO=http://github.com/wiredtiger/wiredtiger.git WT_REPO=http://github.com/wiredtiger/wiredtiger.git
WT_BRANCH=develop WT_BRANCH=develop
WT_DIR=wiredtiger-`basename $WT_BRANCH` WT_DIR=wiredtiger-`basename $WT_BRANCH`
#WT_REF="tags/1.6.4" #WT_REF="tags/1.6.6"
#WT_DIR=wiredtiger-`basename $WT_REF` #WT_DIR=wiredtiger-`basename $WT_REF`
SNAPPY_VSN="1.0.4" SNAPPY_VSN="1.0.4"

View file

@ -440,6 +440,7 @@ __close_cursors_on(WterlConnHandle *conn_handle, const char *uri)
return; return;
} }
/** /**
* Callback to handle error messages. * Callback to handle error messages.
* *
@ -454,13 +455,15 @@ __close_cursors_on(WterlConnHandle *conn_handle, const char *uri)
* operation or library failure. * operation or library failure.
*/ */
int int
__wterl_error_handler(WT_EVENT_HANDLER *handler, int error, const char *message) __wterl_error_handler(WT_EVENT_HANDLER *handler, WT_SESSION *session,
int error, const char *message)
{ {
struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler; struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler;
ErlNifEnv *msg_env; ErlNifEnv *msg_env;
ErlNifPid *to_pid; ErlNifPid *to_pid;
int rc = 0; int rc = 0;
UNUSED(session);
enif_mutex_lock(eh->error_mutex); enif_mutex_lock(eh->error_mutex);
msg_env = eh->msg_env_error; msg_env = eh->msg_env_error;
to_pid = &eh->to_pid; to_pid = &eh->to_pid;
@ -492,13 +495,14 @@ __wterl_error_handler(WT_EVENT_HANDLER *handler, int error, const char *message)
* operation or library failure. * operation or library failure.
*/ */
int int
__wterl_message_handler(WT_EVENT_HANDLER *handler, const char *message) __wterl_message_handler(WT_EVENT_HANDLER *handler, WT_SESSION *session, const char *message)
{ {
struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler; struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler;
ErlNifEnv *msg_env; ErlNifEnv *msg_env;
ErlNifPid *to_pid; ErlNifPid *to_pid;
int rc = 0; int rc = 0;
UNUSED(session);
enif_mutex_lock(eh->message_mutex); enif_mutex_lock(eh->message_mutex);
msg_env = eh->msg_env_message; msg_env = eh->msg_env_message;
to_pid = &eh->to_pid; to_pid = &eh->to_pid;
@ -529,13 +533,14 @@ __wterl_message_handler(WT_EVENT_HANDLER *handler, const char *message)
* operation or library failure. * operation or library failure.
*/ */
int int
__wterl_progress_handler(WT_EVENT_HANDLER *handler, const char *operation, uint64_t counter) __wterl_progress_handler(WT_EVENT_HANDLER *handler, WT_SESSION *session, const char *operation, uint64_t counter)
{ {
struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler; struct wterl_event_handlers *eh = (struct wterl_event_handlers *)handler;
ErlNifEnv *msg_env; ErlNifEnv *msg_env;
ErlNifPid *to_pid; ErlNifPid *to_pid;
int rc = 0; int rc = 0;
UNUSED(session);
enif_mutex_lock(eh->progress_mutex); enif_mutex_lock(eh->progress_mutex);
msg_env = eh->msg_env_progress; msg_env = eh->msg_env_progress;
to_pid = &eh->to_pid; to_pid = &eh->to_pid;
@ -2303,7 +2308,7 @@ on_load(ErlNifEnv *env, void **priv_data, ERL_NIF_TERM load_info)
char msg[1024]; char msg[1024];
snprintf(msg, 1024, "NIF on_load complete (wterl version: %s, wiredtiger version: %s)", priv->wterl_vsn, priv->wiredtiger_vsn); snprintf(msg, 1024, "NIF on_load complete (wterl version: %s, wiredtiger version: %s)", priv->wterl_vsn, priv->wiredtiger_vsn);
__wterl_message_handler((WT_EVENT_HANDLER *)&priv->eh, msg); __wterl_message_handler((WT_EVENT_HANDLER *)&priv->eh, NULL, msg);
return 0; return 0;
} }

View file

@ -22,6 +22,7 @@
-module(riak_kv_wterl_backend). -module(riak_kv_wterl_backend).
-behavior(temp_riak_kv_backend). -behavior(temp_riak_kv_backend).
-compile([{parse_transform, lager_transform}]).
%% KV Backend API %% KV Backend API
-export([api_version/0, -export([api_version/0,
@ -42,7 +43,7 @@
-ifdef(TEST). -ifdef(TEST).
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-compiel(export_all). -compile(export_all).
-endif. -endif.
-define(API_VERSION, 1). -define(API_VERSION, 1).
@ -119,11 +120,14 @@ start(Partition, Config) ->
"lsm" -> "lsm" ->
[{internal_page_max, "128K"}, [{internal_page_max, "128K"},
{leaf_page_max, "16K"}, {leaf_page_max, "16K"},
{lsm_chunk_size, "100MB"}, {lsm, [
{lsm_bloom_oldest, true} , {bloom_config, [{leaf_page_max, "8MB"}]},
{lsm_bloom_bit_count, 28}, {bloom_bit_count, 28},
{lsm_bloom_hash_count, 19}, {bloom_hash_count, 19},
{lsm_bloom_config, [{leaf_page_max, "8MB"}]} {bloom_oldest, true},
{chunk_size, "100MB"},
{merge_threads, 2}
]}
] ++ Compressor; ] ++ Compressor;
"table" -> "table" ->
Compressor Compressor
@ -397,30 +401,41 @@ establish_connection(Config, Type) ->
ok = filelib:ensure_dir(filename:join(DataRoot, "x")), ok = filelib:ensure_dir(filename:join(DataRoot, "x")),
%% WT Connection Options: %% WT Connection Options:
%% NOTE: LSM auto-checkpoints, so we don't have too. LogSetting = app_helper:get_prop_or_env(log, Config, wterl, false),
CheckpointSetting = CheckpointSetting =
case Type =:= "lsm" of case Type =:= "lsm" of
true -> true ->
[]; case LogSetting of
true ->
%% Turn checkpoints on if logging is on, checkpoints enable log archival.
app_helper:get_prop_or_env(checkpoint, Config, wterl, [{wait, 30}]); % in seconds
_ ->
[]
end;
false -> false ->
app_helper:get_prop_or_env(checkpoint, Config, wterl, [{wait, 10}]) app_helper:get_prop_or_env(checkpoint, Config, wterl, [{wait, 30}])
end, end,
RequestedCacheSize = app_helper:get_prop_or_env(cache_size, Config, wterl), RequestedCacheSize = app_helper:get_prop_or_env(cache_size, Config, wterl),
ConnectionOpts = ConnectionOpts =
orddict:from_list( orddict:from_list(
[ wterl:config_value(create, Config, true), [ wterl:config_value(create, Config, true),
wterl:config_value(checkpoint_sync, Config, false), wterl:config_value(checkpoint_sync, Config, false),
wterl:config_value(transaction_sync, Config, "none"),
wterl:config_value(log, Config, [{enabled, LogSetting}]),
wterl:config_value(mmap, Config, false),
wterl:config_value(checkpoint, Config, CheckpointSetting),
wterl:config_value(session_max, Config, max_sessions(Config)), wterl:config_value(session_max, Config, max_sessions(Config)),
wterl:config_value(cache_size, Config, size_cache(RequestedCacheSize)), wterl:config_value(cache_size, Config, size_cache(RequestedCacheSize)),
wterl:config_value(statistics, Config, [ "fast", "clear"]),
wterl:config_value(statistics_log, Config, [{wait, 600}]), % in seconds wterl:config_value(statistics_log, Config, [{wait, 600}]), % in seconds
wterl:config_value(verbose, Config, [ "salvage", "verify" wterl:config_value(verbose, Config, [ "salvage", "verify"
% Note: for some unknown reason, if you add these additional % Note: for some unknown reason, if you add these additional
% verbose flags Erlang SEGV's "size_object: bad tag for 0x80" % verbose flags Erlang SEGV's "size_object: bad tag for 0x80"
% no idea why... yet... you've been warned. % no idea why... you've been warned.
%"block", "shared_cache", "reconcile", "evict", "lsm", %"block", "shared_cache", "reconcile", "evict", "lsm",
%"fileops", "read", "write", "readserver", "evictserver", %"fileops", "read", "write", "readserver", "evictserver",
%"hazard", "mutex", "ckpt" %"hazard", "mutex", "ckpt"
]) ] ++ CheckpointSetting ++ proplists:get_value(wterl, Config, [])), % sec ]) ] ++ proplists:get_value(wterl, Config, [])), % sec
%% WT Session Options: %% WT Session Options:
SessionOpts = [{isolation, "snapshot"}], SessionOpts = [{isolation, "snapshot"}],

View file

@ -454,18 +454,26 @@ config_to_bin([], Acc) ->
config_to_bin([{Key, Value} | Rest], Acc) -> config_to_bin([{Key, Value} | Rest], Acc) ->
ConfigTypes = ConfigTypes =
[{block_compressor, {string, quoted}}, [{block_compressor, {string, quoted}},
{bloom_bit_count, integer},
{bloom_config, config},
{bloom_hash_count, integer},
{bloom_newest, bool},
{bloom_oldest, bool},
{cache_size, string}, {cache_size, string},
{checkpoint, config}, {checkpoint, config},
{checkpoint_sync, bool}, {checkpoint_sync, bool},
{checksum, string}, {checksum, string},
{chunk_size, string},
{create, bool}, {create, bool},
{direct_io, list}, {direct_io, list},
{drop, list}, {drop, list},
{enabled, bool},
{error_prefix, string}, {error_prefix, string},
{eviction_target, integer}, {eviction_target, integer},
{eviction_trigger, integer}, {eviction_trigger, integer},
{extensions, {list, quoted}}, {extensions, {list, quoted}},
{statistics_fast, bool}, {statistics_fast, bool},
{file_max, string},
{force, bool}, {force, bool},
{from, string}, {from, string},
{hazard_max, integer}, {hazard_max, integer},
@ -475,23 +483,21 @@ config_to_bin([{Key, Value} | Rest], Acc) ->
{isolation, string}, {isolation, string},
{key_type, string}, {key_type, string},
{leaf_page_max, string}, {leaf_page_max, string},
{logging, bool}, {log, config},
{lsm_bloom_bit_count, integer}, {lsm, config},
{lsm_bloom_config, config}, {mmap, bool},
{lsm_bloom_hash_count, integer}, {merge_threads, integer},
{lsm_bloom_newest, bool},
{lsm_bloom_oldest, bool},
{lsm_chunk_size, string},
{prefix_compression, bool},
{lsm_merge_threads, integer},
{multiprocess, bool}, {multiprocess, bool},
{name, string}, {name, string},
{overwrite, bool}, {overwrite, bool},
{prefix_compression, bool},
{raw, bool}, {raw, bool},
{session_max, integer}, {session_max, integer},
{statistics, list},
{statistics_log, config}, {statistics_log, config},
{target, {list, quoted}}, {target, {list, quoted}},
{to, string}, {to, string},
{transaction_sync, string},
{transactional, bool}, {transactional, bool},
{verbose, list}, {verbose, list},
{wait, integer}], {wait, integer}],

View file

@ -25,7 +25,7 @@
{mode, max}. {mode, max}.
{duration, 10}. {duration, 10}.
{concurrent, 4}. {concurrent, 16}.
{report_interval, 1}. {report_interval, 1}.
{pb_timeout_general, 1000}. % ms {pb_timeout_general, 1000}. % ms
%{pb_timeout_read, ?}. %{pb_timeout_read, ?}.
@ -43,7 +43,9 @@
{wterl, [ {wterl, [
{connection, [ {connection, [
{create, true}, {create, true},
{sync, false}, {session_sync, false},
{transaction_sync, "none"},
{log, [{enabled, false}]},
{session_max, 1024}, {session_max, 1024},
{cache_size, 4294967296}, {cache_size, 4294967296},
{verbose, []}, {verbose, []},
@ -58,11 +60,11 @@
]}, ]},
{session, [ {isolation, "snapshot"} ]}, {session, [ {isolation, "snapshot"} ]},
{table_uri, "lsm:test"}, {table_uri, "lsm:test"},
{lsm_merge_threads, 2},
{table, [ {table, [
{internal_page_max, "128K"}, {internal_page_max, "128K"},
{leaf_page_max, "128K"}, {leaf_page_max, "128K"},
{lsm_chunk_size, "25MB"}, {lsm_chunk_size, "25MB"},
{prefix_compression, false},
{lsm_bloom_newest, true}, {lsm_bloom_newest, true},
{lsm_bloom_oldest, true} , {lsm_bloom_oldest, true} ,
{lsm_bloom_bit_count, 128}, {lsm_bloom_bit_count, 128},
@ -76,7 +78,9 @@
{wterl_, [ {wterl_, [
{connection, [ {connection, [
{create, true}, {create, true},
{sync, false}, {session_sync, false},
{transaction_sync, "none"},
{log, [{enabled, false}]},
{session_max, 1024}, {session_max, 1024},
{cache_size, 4294967296}, {cache_size, 4294967296},
{verbose, []}, {verbose, []},
@ -93,7 +97,6 @@
{session, [ {isolation, "snapshot"} ]}, {session, [ {isolation, "snapshot"} ]},
{table_uri, "table:test"}, {table_uri, "table:test"},
{table, [ {table, [
{prefix_compression, false},
{block_compressor, "snappy"} % bzip2 {block_compressor, "snappy"} % bzip2
]} ]}
]}. ]}.