answer is 'no'). So far there has been no effort to validate that these
settings are in fact the best for Riak/KV or CS data access patterns. These
particular settings are, at best, an educated guess based on past experience,
the docs and reading about the benchmark the WiredTiger team published here:
https://github.com/wiredtiger/wiredtiger/wiki/YCSB-Mapkeeper-benchmark
Before modifying files to add wterl, check to make sure the addition hasn't
already been made. Also change to do a stagedevrel build instead of a
devrel build.
Versions of WiredTiger prior to 1.3.3 had trouble handling riak restarts,
returning errors from wterl:session_create that would prevent riak from
restarting if it was not cleanly shut down on the previous run. We
previously avoided checking the return value of wterl:session_create to
avoid this problem. WT 1.3.3 fixes this, so reinstate the check of the
wterl:session_create return value.
Since 1.3.0 folded the session sync function into the session checkpoint
function, the wterl:sync/(2,3) functions are now renamed
wterl:checkpoint/(1,2). See
http://source.wiredtiger.com/1.3.0/upgrading.html for details.
The wterl:session_get function was fetching a value using a cursor, then
closing the cursor, and then trying to use the fetched value to create the
return binary. According to the WiredTiger documentation, this is a no-no
-- a value is good only until the next operation on the cursor used to
fetch it. We've been seeing occasional segmentation violations in the
memcpy for the fetched value, and this might explain it.
Make the unit tests call riak_kv_backend:standard_test like other
backends do for their unit tests. This is a little awkward at the
moment because riak_kv_backend.erl doesn't live in this repository, so
it requires temporarily copying it into src to run "rebar eunit".
The backend fold_objects was failing because it was trying to use
wterl:fold_keys/3, which doesn't fold over values. Add fold/3 to
wterl.erl to fix this.
Also clean up a few dialyzer warnings.
WiredTiger session count defaults to 50, but we need at least one per
vnode, so for now hard-code it to 100. Also ignore table creation
results in the kv backend because WiredTiger is currently producing a
strange error if the table already exists.
In order to reduce the number of wiredtiger session open/close calls,
open a session at startup and keep it in the kv backend state. This is
safe as far as using these sessions on scheduler threads goes because
the riak_kv_vnode fsm serializes all calls through the backend, so
we'll never have a case of multiple scheduler threads concurrently
trying to use the same session.
Add a temporary copy of riak_kv_backend, renamed to
temp_riak_kv_backend, to allow wterl to build on its own. This file
must be deleted when riak_kv_wterl_backend is moved to its proper
place in riak_kv.