Why does sending X-Riak-ClientId prevent subsequent updates?

Jay Doane jay.s.doane at gmail.com
Sat Feb 6 18:48:58 EST 2010

I'm using the new (raw) riak.py client library, and testing multiple  
updates to the same object with the following doctest file (also  

$ cat riak_test.py

 >>> import riak
 >>> client = riak.Riak('', 8098)
 >>> client.delete('b', 'k')
 >>> client.store('b', 'k', {'foo':0})
{'object': {u'foo': 0}}
 >>> client.store('b', 'k', {'foo':1})
{'object': {u'foo': 1}}
 >>> client.store('b', 'k', {'foo':2})
{'object': {u'foo': 2}}

import doctest

When run against the 0.8 release, the final store operation always  

$ python riak_test.py
File "riak_test.py", line 9, in __main__
Failed example:
     client.store('b', 'k', {'foo':2})
     {'object': {u'foo': 2}}
     {'object': {u'foo': 1}}
1 items had failures:
    1 of   6 in __main__
***Test Failed*** 1 failures.

Usually, that's all there is to the failure, but sometimes,  
unpredictably, I see the following on the riak console:

=ERROR REPORT==== 6-Feb-2010::14:53:48 ===
webmachine error: path="/raw/b/k"
                   {riak_client,'riak at',<<1,11,16,235>>},

However, if I alter riak.py so that it doesn't send the X- 
Riak_ClientId header, the tests all pass.  Here's the trivial diff  
(also attached)

diff -r c4486329e4af client_lib/riak.py
--- a/client_lib/riak.py        Wed Feb 03 15:51:26 2010 -0500
+++ b/client_lib/riak.py        Sat Feb 06 15:31:36 2010 -0800
@@ -135,8 +135,7 @@

      def store(self, bucket, key, obj, links=[], w=2, dw=2):
-        uphead = {'Content-Type': 'application/json',
-                  'X-Riak-ClientId': self.clientid}
+        uphead = {'Content-Type': 'application/json'}
              uphead['X-Riak-Vclock'] = obj['__riak_vclock__']
          except KeyError:

Any ideas what's going on?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: riak_test.py
Type: text/x-python-script
Size: 314 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20100206/16688af0/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: riak.diff
Type: application/octet-stream
Size: 454 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20100206/16688af0/attachment.diff>

More information about the riak-users mailing list