basho/yokozuna — pull request #167 by rzezeski (2013-09-07 03:08:01+00:00)
Title: Use periodic sync for hashtree updates

While running the yokozuna_essential test I noticed vnodes crashing
because of unexpected `{ref(),ok}` messages being handled by
`riak_kv_vnode:handle_info`. The yokozuna index function,
`yz_kv:index` runs on the KV vnode process. Part of that function is
to update the Yokozuna hashtree. It does that by making a
gen_server:call with a timeout of 1 second. If this call times out
then the reply ends up being handled by the KV vnode `handle_info`
callback which has no function head for that reply. Thus crashing the
vnode and causing pain.

This patch updates Yokozuna's hashtree update to be like KV. It uses
mostly async updates followed by the occasional blocking call with
`infinity` timeout. This a) reduces overhead of most updates and b)
prevents chance of an unexpected msg making it to the KV vnode
callback.

I also removed the try/catch around the hashtree update since there is
already one in the `index` function covering this call.