basho / riak-erlang-client

The Riak client for Erlang.
Apache License 2.0
311 stars 188 forks source link

Unable to use riak with strongly consistent buckets. #361

Open fire opened 7 years ago

fire commented 7 years ago

How do you use riak with strongly consistent buckets? Errors with {:error, "`undefined` is not a supported type"}

# Create a 3 node riak cluster
riak-admin bucket-type create strongly_consistent \ 
  '{"props":{"consistent":true}}'
riak-admin bucket-type activate strongly_consistent
# Test if the cluster is working
curl -v 172.17.0.2:8098/types/strongly_consistent/buckets/test/keys/hello \
  -X PUT \
  -H "Content-type: text/plain" \
  -d "world"
curl -v 172.17.0.2:8098/types/strongly_consistent/buckets/test/keys/hello
# Elixir
{:ok, pid} = Riak.Connection.start_link('172.17.0.2', 8087)
{:ok, #PID<0.399.0>}
iex(3)> :riakc_pb_socket.fetch_type(pid, {"strongly_consistent", "test"}, "hello")
{:error, "`undefined` is not a supported type"}
fire commented 7 years ago

Weird, but

iex(7)> :riakc_pb_socket.get(pid, {"strongly_consistent", "test"}, "hello")
{:ok,
 {:riakc_obj, {"strongly_consistent", "test"}, "hello",
  <<107, 206, 97, 96, 96, 96, 204, 96, 74, 97, 96, 73, 45, 78, 45, 204, 96,
    202, 99, 101, 112, 0, 9, 1, 105, 198, 179, 249, 151, 248, 178, 0>>,
  [{{:dict, 3, 16, 16, 8, 80, 48,
     {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []},
     {{[], [], [], [], [], [], [], [], [], [],
       [["content-type", 116, 101, 120, 116, 47, 112, 108, 97, 105, 110],
        ["X-Riak-VTag", 51, 66, 120, 87, 50, 84, 53, 68, 117, 97, 117, 71,
         72, 85, 89, 101, 80, 55, 65, 109, 109, 118]], [], [],
       [["X-Riak-Last-Modified" | {1492, 865281, 773593}]], [], []}}},
    "world"}], :undefined, :undefined}}

works.