You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Zubair Quraishi <zu...@gmail.com> on 2010/04/30 15:16:49 UTC

Mutate function not working

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}]}}}

Re: Mutate function not working

Posted by Zubair Quraishi <zu...@gmail.com>.
The full exception 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}]}}}


On Fri, Apr 30, 2010 at 3:21 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> You could try asking on the user@ list, but it looks like erlang is
> eating an invalidrequestexception which is not very helpful.
>
> On Fri, Apr 30, 2010 at 8:16 AM, Zubair Quraishi <zu...@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}]}}}
>>
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of Riptano, the source for professional Cassandra support
> http://riptano.com
>

Re: Mutate function not working

Posted by Jonathan Ellis <jb...@gmail.com>.
You could try asking on the user@ list, but it looks like erlang is
eating an invalidrequestexception which is not very helpful.

On Fri, Apr 30, 2010 at 8:16 AM, Zubair Quraishi <zu...@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}]}}}
>



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