Skip to content

Commit

Permalink
Merge pull request #368 from basho/eas-merge-1.4.2
Browse files Browse the repository at this point in the history
Merge 1.4.2 to develop
  • Loading branch information
engelsanchez committed Sep 5, 2013
2 parents 9a6074a + 05e0cec commit c2f06d6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ebin/riak_core.app
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{application, riak_core,
[
{description, "Riak Core"},
{vsn, "1.4.1"},
{vsn, "1.4.2"},
{modules, [
app_helper,
bloom,
Expand Down
33 changes: 20 additions & 13 deletions src/riak_core_handoff_sender.erl
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,28 @@ visit_item(K, V, Acc) ->

case Filter(K) of
true ->
BinObj = Module:encode_handoff_item(K, V),

ItemQueue2 = [BinObj | ItemQueue],
ItemQueueLength2 = ItemQueueLength + 1,
ItemQueueByteSize2 = ItemQueueByteSize + byte_size(BinObj),

Acc2 = Acc#ho_acc{item_queue_length=ItemQueueLength2,
item_queue_byte_size=ItemQueueByteSize2},

case Module:encode_handoff_item(K, V) of
corrupted ->
{Bucket, Key} = K,
lager:warning("Unreadable object ~p/~p discarded",
[Bucket, Key]),
Acc;
BinObj ->

ItemQueue2 = [BinObj | ItemQueue],
ItemQueueLength2 = ItemQueueLength + 1,
ItemQueueByteSize2 = ItemQueueByteSize + byte_size(BinObj),

Acc2 = Acc#ho_acc{item_queue_length=ItemQueueLength2,
item_queue_byte_size=ItemQueueByteSize2},

%% Unit size is bytes:
HandoffBatchThreshold = app_helper:get_env(riak_core, handoff_batch_threshold, 1024*1024),
HandoffBatchThreshold = app_helper:get_env(riak_core, handoff_batch_threshold, 1024*1024),

case ItemQueueByteSize2 =< HandoffBatchThreshold of
true -> Acc2#ho_acc{item_queue=ItemQueue2};
false -> send_objects(ItemQueue2, Acc2)
case ItemQueueByteSize2 =< HandoffBatchThreshold of
true -> Acc2#ho_acc{item_queue=ItemQueue2};
false -> send_objects(ItemQueue2, Acc2)
end
end;

false ->
Expand Down
10 changes: 7 additions & 3 deletions src/riak_core_stat_q.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ get_stat(Stat) ->
Pid = riak_core_stat_calc_sup:calc_proc(Stat),
riak_core_stat_calc_proc:value(Pid).

throw_folsom_error({error, _, _} = Err) ->
throw(Err);
throw_folsom_error(Other) -> Other.

%% Encapsulate getting a stat value from folsom.
%%
%% If for any reason we can't get a stats value
Expand All @@ -99,21 +103,21 @@ get_stat(Stat) ->
%% stats that are broken?
calc_stat({Name, gauge}) ->
try
GaugeVal = folsom_metrics:get_metric_value(Name),
GaugeVal = throw_folsom_error(folsom_metrics:get_metric_value(Name)),
calc_gauge(GaugeVal)
catch ErrClass:ErrReason ->
log_error(Name, ErrClass, ErrReason),
unavailable
end;
calc_stat({Name, histogram}) ->
try
folsom_metrics:get_histogram_statistics(Name)
throw_folsom_error(folsom_metrics:get_histogram_statistics(Name))
catch ErrClass:ErrReason ->
log_error(Name, ErrClass, ErrReason),
unavailable
end;
calc_stat({Name, _Type}) ->
try folsom_metrics:get_metric_value(Name)
try throw_folsom_error(folsom_metrics:get_metric_value(Name))
catch ErrClass:ErrReason ->
log_error(Name, ErrClass, ErrReason),
unavailable
Expand Down

0 comments on commit c2f06d6

Please sign in to comment.