Skip to content

Instantly share code, notes, and snippets.

View jtuple's full-sized avatar

Joseph Blomstedt jtuple

  • Facebook
  • Seattle, WA
View GitHub Profile
@jtuple
jtuple / riak_ring.erl
Created August 25, 2011 19:08
Script to print Riak ring ownership information
%% Script to print out Riak ring ownership.
%% Copy/paste into Erlang shell attached to a riak cluster (riak-admin attach).
%% Remember to use: CTRL-D to dettach from the shell once done.
fun() ->
{ok, Ring} = riak_core_ring_manager:get_my_ring(),
Owners = riak_core_ring:all_members(Ring),
Indices = riak_core_ring:all_owners(Ring),
RingSize = length(Indices),
Names = lists:zip(Owners, lists:seq(1, length(Owners))),

The specific issue we care about is previously written data silently being corrupted by disk (eg. bit rot)

Consider paxos+log or Raft style approach. Once value is committed from log to replicated state/DB, it's assumed to be stable. But, there's no guarantee the disk doesn't lose that data later. While the current approach in Riak doesn't use traditional propose/commit log, the underlying problem is the same.

Example of problem we want to avoid.

We have 3-replicas, A/B/C with the following committed state (no other operations in flight):
A: a=100, b=200 (currently offline/partitioned)
dvvset.erl:157: Invalid type specification for function dvvset:update/2. The success typing is ({[{_,non_neg_integer()}],[any(),...]},_) -> {[{_,non_neg_integer()},...],[]}
dvvset.erl:169: Invalid type specification for function dvvset:update/3. The success typing is ({[{_,non_neg_integer(),[any()]}],[any(),...]},{[{_,non_neg_integer(),[any()]}],[any()]},_) -> {[{_,non_neg_integer()},...],[any()]}
riak_core_metadata.erl:190: The call riak_core_metadata:itr_default({_,_}) does not have an opaque term of type riak_core_metadata:iterator() as 1st argument
riak_core_metadata.erl:215: The call riak_core_metadata:itr_default({_,_}) does not have an opaque term of type riak_core_metadata:iterator() as 1st argument
<html>
<body>
Testing
</body>
</html>

A Glimpse Into The Future of Riak at RICON 2012

On October 10th, the two-day RICON 2012 conference kicks off with a focus on distributed systems. Yes, there will be a large focus on Riak. The talk schedule makes that clear. However, the focus on the conference is really about distributed systems and getting smart people to come together and hang out for a couple days. Like many conferences, the most memorable element is going to be the people you meet and the side conversations over coffee and beer.

$ ./dev/dev2/bin/riak-admin join dev1@127.0.0.1
The 'join' command has been deprecated in favor of the new
clustering commands provided by 'riak-admin cluster'. To continue
using the deprecated 'join' command, use 'join -f'
$ ./dev/dev2/bin/riak-admin cluster
Usage: riak-admin cluster <command>
The following commands stage changes to cluster membership. These commands
do not take effect immediately. After staging a set of changes, the staged
$ ./dev/dev2/bin/riak-admin join dev1@127.0.0.1
The 'join' command has been deprecated in favor of the new
clustering commands provided by 'riak-admin cluster'. To continue
using the deprecated 'join' command, use 'join -f'
$ ./dev/dev2/bin/riak-admin cluster
Usage: riak-admin cluster <command>
The following commands stage changes to cluster membership. These commands
do not take effect immediately. After staging a set of changes, the staged
$ /tmp/rt/dev/dev3/bin/riak-admin cluster plan
=============================== Staged Changes ================================
Action Nodes(s)
-------------------------------------------------------------------------------
join 'dev30@127.0.0.1'
force-replace 'dev3@127.0.0.1' with 'dev30@127.0.0.1'
-------------------------------------------------------------------------------
WARNING: All of 'dev3@127.0.0.1' replicas will be lost
$ ./dev/dev2/bin/riak-admin cluster plan
=============================== Staged Changes ================================
Action Nodes(s)
-------------------------------------------------------------------------------
leave 'dev2@127.0.0.1'
join 'dev3@127.0.0.1'
-------------------------------------------------------------------------------
NOTE: Applying these changes will result in 2 cluster transitions
@jtuple
jtuple / gist:2713348
Created May 16, 2012 19:40
node replacement working, woo!
Staged changes:
(join) 'dev2@127.0.0.1'
(replace) 'dev3@127.0.0.1' -> 'dev2@127.0.0.1'
Member status after changes:
================================= Membership ==================================
Status Ring Pending Node
-------------------------------------------------------------------------------
leaving 32.8% 0.0% 'dev3@127.0.0.1'
valid 34.4% 34.4% 'dev1@127.0.0.1'