Skip to content

Instantly share code, notes, and snippets.

View binarytemple's full-sized avatar

Bryan Hunt binarytemple

  • The mountains of mourne
View GitHub Profile

autoscale: true build-lists: true slidenumbers: true

Tracing Riak with Redbug

An example of how to use Redbug to trace Riak internals, taking as an example an inexplicably failing secondary index range query.


Erlang Tracing: more than you wanted to know

Rough Outline

  • What can be traced?
  • How can trace events be specified?
  • "match specifications": twisty passages, all alike
  • WTF, can I just use DTrace and drink my coffee/beer/whisky in peace?
  • Trace delivery mechanisms: pick one of two

#Map Reduce Delete Instructions

Set allow_strfun true on all nodes:

echo "rpc:multicall([node() | nodes()], application,set_env,[riak_kv,allow_strfun,true])." | bin/riak attach

Insert 15000 keys:

for i in {1..15000}; do curl -XPUT http://127.0.0.1:9000/buckets/test/keys/test$i -H "content-type: text/plain" -d "Data #$i\n"; done
@binarytemple
binarytemple / query.riak.realtime.queue.markdown
Last active February 2, 2016 21:47
Query objects on the real time queue (with sizes)

Load 10Mb of data into /tmp/foo:

sudo dd if=/dev/disk0 of=/tmp/foo bs=1m count=10

Start loading it into dev1 node

for i in `seq 1 10000`
do curl -XPUT "http://localhost:10018/buckets/food3/keys/ooopp$i" -d@/tmp/foo  
@binarytemple
binarytemple / multiple_push_pull.rb
Created June 1, 2015 14:14
sketchup script that allows you to push or pull multiple objects at once
require 'sketchup.rb'
# unknown origin or usage rights...
module BR_push_pull
def BR_push_pull.main
model = Sketchup.active_model
selection = model.selection

Startup the PUT FSM - code

%% @private
init([From, RObj, Options0, Monitor]) ->
    BKey = {Bucket, Key} = {riak_object:bucket(RObj), riak_object:key(RObj)},
    CoordTimeout = get_put_coordinator_failure_timeout(),
@binarytemple
binarytemple / set.arbitrary.vm.args.flags.via.cuttlefish.markdown
Last active August 29, 2015 14:20
How to set arbitrary vm.args flags using cuttlefish

A pass through mechanism exists in the erlang.distribution cuttlefish component where you can pass any arbitrary flag you please down into the generated vm.args file.

Lets demonstrate the mechanism...

Firstly

Add a new flag into the riak.conf file.

echo "erlang.distribution.net_ticktime=15" >> ./dev1/etc/riak.conf
@binarytemple
binarytemple / build.riak.2.10.devrel.markdown
Last active August 29, 2015 14:20
Build riak 2.1.0 devrel
kerl build git git://github.com/basho/otp.git otp-16b02-basho otp-16b02-basho
kerl install otp-16b02-basho /erls/otp-16b02-basho
. /erls/otp-16b02-basho/activate
make devrel
@binarytemple
binarytemple / sourceforge.to.github.impor.markdown
Created April 27, 2015 09:05
import a sourceforge project (with full history) to github

In order to clone the TVN application from sourceforge to github I performed the following steps.

rsync -av rsync://tnv.cvs.sourceforge.net/cvsroot/tnv/* .
svn export --username=guest http://cvs2svn.tigris.org/svn/cvs2svn/trunk cvs2svn-trunk
cp ./cvs2svn-trunk/cvs2git-example.options ./cvs2git.options
vim cvs2git.options
cvs2svn-trunk/cvs2git --options=cvs2git.options --fallback-encoding utf-8
git@github.com:binarytemple/tnv.git tnv-github
git clone git@github.com:binarytemple/tnv.git tnv-github
@binarytemple
binarytemple / populate-riak.sh
Created April 23, 2015 22:00
Magnus uuid populating script, works on centos 7
#!/bin/bash
for i in {0..10000}
do
uuid=$(uuidgen)
echo ${uuid}
curl -XPUT http://127.0.0.1:8098/types/default/buckets/test/keys/${uuid} -H "Content-Type: application/json" -d "{\"uuid\": \"${uuid}\", \"date\": \"$(date "+%FT%T.%N:Z")\"}"
done