like I told you on the other list, erlang or the erlang thrift
compiler is not exposing the error the cassandra server is sending
you.  "bad_return_value" is not it.

Unless someone with actual erlang experience chimes in here, I would
suggest trying with Python first, at least that will show you the real
error.  Then you can port back to erlang if you want.

On Fri, Apr 30, 2010 at 8:58 AM, Zubair Quraishi <zuba...@gmail.com> wrote:
> I have the following code in Erlang to set a value and then add a
> property. The first set works but the mutate fails. Can anyone
> enlighten me?
> Thanks
>
>  {ok, C} = thrift_client:start_link("127.0.0.1",9160, cassandra_thrift),
>
>  Key = "Key1",
>
>  %
>  % set first property
>  %
>  thrift_client:call( C,
>                  'insert',
>                  [ "Keyspace1",
>                    Key,
>                    #columnPath{column_family="KeyValue", column="value"},
>                    "value1",
>                    1,
>                    1
>                    ] ),
>
>  %
>  % set second property ( fails! - why? )
>  %
>  MutationMap =
>  {
>   Key,
>   {
>     <<"KeyValue">>,
>     [
>       #mutation{
>         column_or_supercolumn = #column{ name = "property" , value =
> "value" , timestamp = 2 }
>       }
>     ]
>   }
>  },
>  thrift_client:call( C,
>   'batch_mutate',
>   [ "Keyspace1",
>      MutationMap,
>      1
>   ] )
>
> : The error returned is :
>
> ** exception exit: {bad_return_value,{error,{function_clause,[{dict,size,
>                                                                   [{"Key1",
>
> {<<"KeyValue">>,
>
> [{mutation,{column,"property","value",2},undefined}]}}]},
>
> {thrift_protocol,write,2},
>
> {thrift_protocol,struct_write_loop,3},
>
> {thrift_protocol,write,2},
>
> {thrift_client,send_function_call,3},
>
> {thrift_client,'-handle_call/3-fun-0-',3},
>
> {thrift_client,catch_function_exceptions,2},
>
> {thrift_client,handle_call,3}]}}}
> 7>
> =ERROR REPORT==== 30-Apr-2010::15:13:42 ===
> ** Generic server <0.55.0> terminating
> ** Last message in was {call,batch_mutate,
>                          ["Keyspace1",
>                           {"Key1",
>                            {<<"KeyValue">>,
>                             [{mutation,
>                                  {column,"property","value",2},
>                                  undefined}]}},
>                           1]}
> ** When Server state == {state,cassandra_thrift,
>                        {protocol,thrift_binary_protocol,
>                         {binary_protocol,
>                          {transport,thrift_buffered_transport,<0.58.0>},
>                          true,true}},
>                        0}
> ** Reason for termination ==
> ** {bad_return_value,
>      {error,
>          {function_clause,
>              [{dict,size,
>                   [{"Key1",
>                     {<<"KeyValue">>,
>                      [{mutation,
>                           {column,"property","value",2},
>                           undefined}]}}]},
>               {thrift_protocol,write,2},
>               {thrift_protocol,struct_write_loop,3},
>               {thrift_protocol,write,2},
>               {thrift_client,send_function_call,3},
>               {thrift_client,'-handle_call/3-fun-0-',3},
>               {thrift_client,catch_function_exceptions,2},
>               {thrift_client,handle_call,3}]}}}
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Reply via email to