anchor.diff:  -module(riak_kv_stat).
   
   -behaviour(gen_server).
  +
  +-ifdef(TEST).
  +-include_lib("eunit/include/eunit.hrl").
  +-endif.
   
   %% API
   -export([start_link/0, get_stats/0,
  
positive.code: multibackend_read_block_errors(_, Val) ->
      rbe_val(Val).
  
  rbe_val(undefined) ->
      undefined;
  rbe_val(Bin) ->
      list_to_integer(binary_to_list(Bin)).
  
negative.code:     %% on this node at random
      %% and ask for it's stats
      {ok, R} = riak_core_ring_manager:get_my_ring(),
      case riak_core_ring:my_indices(R) of
          [] -> undefined;
          [Idx] ->
              Status = vnode_status(Idx),
              leveldb_read_block_errors(Status);
          Indices ->
              %% technically a call to status is a vnode
              %% operation, so spread the load by picking
              %% a vnode at random.
              Nth = crypto:rand_uniform(1, length(Indices)),
              Idx = lists:nth(Nth, Indices),
              Status = vnode_status(Idx),
              leveldb_read_block_errors(Status)
      end.
  
  vnode_status(Idx) ->
      PList = [{Idx, node()}],
      [{Idx, [Status]}] = riak_kv_vnode:vnode_status(PList),
      Status.
  
  leveldb_read_block_errors({backend_status, riak_kv_eleveldb_backend, Status}) ->
      rbe_val(proplists:get_value(read_block_error, Status));
  