basho/riak-ruby-client — Issue #5: PB client unnecessarily fetched object when storing object using prevent_stale_writes
Author: seancribbs
Created: 2012-01-12 21:09:14+00:00
State: open
Labels: bug

Moved from https://github.com/seancribbs/ripple/issues/233 by @eliaslevy:

If you set prevent_stale_writes the PB client first fetches the key to compare the vector clocks itself. See beefcake_protobuffs_backend.rb: store_object.

But this is unnecessary and adds an additional round trip of latency to the request. Riak supports the if_not_modified options in the PB interface, which will let Riak perform the check itself.

See http://wiki.basho.com/PBC-Store-Object.html

## Copied Comments

#### @seancribbs on October 29, 2011

I wanted to avoid it, but we'll need to make a get_server_info request to determine whether this option is even available. Unfortunately, if you send unknown fields in a PB message, the Erlang side will crash (known issue, not being fixed on 0.14.x).