anchor.diff:  
   last_in_ring() ->
       <<1461501637330902918203684832716283019655932542975:160/unsigned>>.
  +
  +six_node_test() ->
  +    %% its non-trivial to create a real 6 node ring, so here's one we made
  +    %% earlier
  +    {ok, [Ring]} = file:consult("../test/my_ring"),
  +    %DocIdx = riak_core_util:chash_key({<<"foo">>, <<"bar">>}),
  +    DocIdx = <<73,212,27,234,104,13,150,207,0,82,86,183,125,225,172,
  +      154,135,46,6,112>>,
  +
  +    Nodes = ['dev1@127.0.0.1', 'dev2@127.0.0.1', 'dev3@127.0.0.1',
  +        'dev4@127.0.0.1', 'dev5@127.0.0.1', 'dev6@127.0.0.1'],
  +
  +    %% Fallbacks should be selected by finding the next-highest partition after
  +    %% the DocIdx of the key, in this case the 433883 partition. The N
  +    %% partitions at that point are the primary partitions. If any of the primaries
  +    %% are down, the next up node found by walking the preflist is used as the
  +    %% fallback for that partition.
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev2@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev3@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev4@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes)),
  +
  +    ?assertEqual([{456719261665907161938651510223838443642478919680, 'dev3@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev4@127.0.0.1'},
  +                  {433883298582611803841718934712646521460354973696, 'dev5@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev2@127.0.0.1'])),
  +
  +    ?assertEqual([{479555224749202520035584085735030365824602865664, 'dev4@127.0.0.1'},
  +                  {433883298582611803841718934712646521460354973696, 'dev5@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev6@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev2@127.0.0.1', 'dev3@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev5@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev6@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev1@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev2@127.0.0.1', 'dev3@127.0.0.1',
  +                      'dev4@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev5@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev6@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev5@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev2@127.0.0.1', 'dev3@127.0.0.1',
  +                      'dev4@127.0.0.1', 'dev1@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev2@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev3@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev5@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev4@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev2@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev5@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev6@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev4@127.0.0.1', 'dev3@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev2@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev5@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev1@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev4@127.0.0.1', 'dev3@127.0.0.1',
  +                      'dev6@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev2@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev5@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev2@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev4@127.0.0.1', 'dev3@127.0.0.1',
  +                      'dev6@127.0.0.1', 'dev1@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev2@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev2@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev2@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev4@127.0.0.1', 'dev3@127.0.0.1',
  +                      'dev6@127.0.0.1', 'dev1@127.0.0.1', 'dev5@127.0.0.1'])),
  +
  +    ?assertEqual([{433883298582611803841718934712646521460354973696, 'dev2@127.0.0.1'},
  +                  {479555224749202520035584085735030365824602865664, 'dev4@127.0.0.1'},
  +                  {456719261665907161938651510223838443642478919680, 'dev5@127.0.0.1'}],
  +              get_apl(DocIdx, 3, Ring, Nodes -- ['dev3@127.0.0.1'])),
  +
  +    ok.
  +
   -endif.
  
positive.code:                  get_apl(last_in_ring(), 3, Ring, [nodeb, nodec, noded])),
      %% With two nodes down
      ?assertEqual([{365375409332725729550921208179070754913983135744,nodec},
                    {0,nodec},
                    {182687704666362864775460604089535377456991567872,noded}],
                   get_apl(last_in_ring(), 3, Ring,  [nodec, noded])),
      %% With the other two nodes down
      ?assertEqual([{0,nodea},
  
negative.code: %% Find fallbacks for downed nodes in the preference list
  -spec find_fallbacks(preflist(), preflist(), [node()], preflist2()) -> preflist2().
  find_fallbacks(_Pangs, [], _UpNodes, Secondaries) ->
      lists:reverse(Secondaries);
  find_fallbacks([], _Fallbacks, _UpNodes, Secondaries) ->
      lists:reverse(Secondaries);
  find_fallbacks([{Partition, _Node}|Rest]=Pangs, [{_,FN}|Fallbacks], UpNodes, Secondaries) ->
      case is_up(FN, UpNodes) of
          true ->
  