Skip to content

Instantly share code, notes, and snippets.

View cdahlqvist's full-sized avatar

Christian Dahlqvist cdahlqvist

  • Independent
  • Valencia, Spain
View GitHub Profile
#!/usr/bin/env escript
main(Args) ->
% - From nodetool ------------------------------------------------------- %
{_, TargetNode} = process_args(Args, [], undefined),
case {net_kernel:connect_node(TargetNode), net_adm:ping(TargetNode)} of
{true, pong} ->
-module(robin_handoff).
-export([start/0,start/1,start/2,stop/0]).
-export([step/0]).
%% see if a handoff is in progress
active_count(Node) when is_atom(Node) ->
Receivers=rpc:call(Node,supervisor,count_children,[riak_core_handoff_receiver_sup]),

This is an erlang snippet to be run from a riak attach session

After pasting the following into the attach session, to repair all riak_kv partitions, run

RepairProc = RepairAllKv(60).

or, to repair all riak_search partitions, run

RepairProc = RepairAllSearch(60).
#!/usr/bin/env escript
%% -*- erlang -*-
-include_lib("kernel/include/file.hrl").
-compile(export_all).
-define(LOG(S), io:format(S)).
-define(LOG(S,A), io:format(S,A)).
main(Dirs) ->
CodePath = case os:getenv("RIAK_LIB") of
PBStatusFun = fun() ->
VnodePids = [Pid || {_, Pid} <- riak_core_vnode_manager:all_index_pid(riak_kv_vnode)],
Links = [process_info(Pid, [links]) || Pid <- VnodePids],
WorkerPoolPids = [WPPid || [{links,[_, WPPid]}] <- Links],
WorkerPoolLinks = [process_info(Pid, [links]) || Pid <- WorkerPoolPids],
PoolboyPids = [PoolboyPid || [{links,[_, PoolboyPid]}] <- WorkerPoolLinks],
[poolboy:status(Pid) || Pid <- PoolboyPids]
end.
PBStatusCountFun = fun() ->