Skip to content

Riak 1.4 Feature: Protocol Buffers Bucket Properties #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 1, 2013

Conversation

seancribbs
Copy link

Riak 1.4 adds all known, standard bucket properties to the Protocol
Buffers transport for setting and getting, and adds the "reset" or
"clear" feature as well.

  • Support all bucket properties over PB
  • Support "reset" or "clear" request/response over PB
  • Feature detect whether the server supports 1.4 bucket props over PB

@ghost ghost assigned seancribbs Jun 26, 2013
@seancribbs
Copy link
Author

Note that against 1.3.x, I would expect to see these failures:

======================================================================
ERROR: test_disable_search_commit_hook (riak.tests.test_all.RiakPbcTransportTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sean/dev/riak-python-client/riak/tests/test_search.py", line 34, in test_disable_search_commit_hook
    bucket.enable_search()
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 390, in enable_search
    self.set_property('search', True)
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 299, in set_property
    return self.set_properties({key: value})
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 318, in set_properties
    self._client.set_bucket_props(self, props)
  File "/Users/sean/dev/riak-python-client/riak/client/transport.py", line 125, in wrapper
    return self._with_retries(pool, thunk)
  File "/Users/sean/dev/riak-python-client/riak/client/transport.py", line 67, in _with_retries
    return fn(transport)
  File "/Users/sean/dev/riak-python-client/riak/client/transport.py", line 123, in thunk
    return fn(self, transport, *args, **kwargs)
  File "/Users/sean/dev/riak-python-client/riak/client/operations.py", line 90, in set_bucket_props
    return transport.set_bucket_props(bucket, props)
  File "/Users/sean/dev/riak-python-client/riak/transports/pbc/transport.py", line 284, in set_bucket_props
    raise NotImplementedError('Server only supports n_val and '
NotImplementedError: Server only supports n_val and allow_mult properties over PBC

======================================================================
ERROR: test_enable_search_commit_hook (riak.tests.test_all.RiakPbcTransportTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sean/dev/riak-python-client/riak/tests/test_search.py", line 25, in test_enable_search_commit_hook
    bucket.enable_search()
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 390, in enable_search
    self.set_property('search', True)
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 299, in set_property
    return self.set_properties({key: value})
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 318, in set_properties
    self._client.set_bucket_props(self, props)
  File "/Users/sean/dev/riak-python-client/riak/client/transport.py", line 125, in wrapper
    return self._with_retries(pool, thunk)
  File "/Users/sean/dev/riak-python-client/riak/client/transport.py", line 67, in _with_retries
    return fn(transport)
  File "/Users/sean/dev/riak-python-client/riak/client/transport.py", line 123, in thunk
    return fn(self, transport, *args, **kwargs)
  File "/Users/sean/dev/riak-python-client/riak/client/operations.py", line 90, in set_bucket_props
    return transport.set_bucket_props(bucket, props)
  File "/Users/sean/dev/riak-python-client/riak/transports/pbc/transport.py", line 284, in set_bucket_props
    raise NotImplementedError('Server only supports n_val and '
NotImplementedError: Server only supports n_val and allow_mult properties over PBC

======================================================================
ERROR: test_primary_quora (riak.tests.test_all.RiakPbcTransportTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sean/dev/riak-python-client/riak/tests/test_kv.py", line 471, in test_primary_quora
    self.assertEqual(bucket.pr, 0)
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 30, in _prop_getter
    return self.get_property(name)
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 309, in get_property
    return self.get_properties()[key]
KeyError: 'pr'

======================================================================
ERROR: test_rw_settings (riak.tests.test_all.RiakPbcTransportTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sean/dev/riak-python-client/riak/tests/test_kv.py", line 446, in test_rw_settings
    self.assertEqual(bucket.r, "quorum")
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 30, in _prop_getter
    return self.get_property(name)
  File "/Users/sean/dev/riak-python-client/riak/bucket.py", line 309, in get_property
    return self.get_properties()[key]
KeyError: 'r'

======================================================================
FAIL: test_clear_bucket_properties (riak.tests.test_all.RiakPbcTransportTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sean/dev/riak-python-client/riak/tests/test_kv.py", line 491, in test_clear_bucket_properties
    self.assertTrue(bucket.clear_properties())
AssertionError: False is not true

----------------------------------------------------------------------

@evanmcc
Copy link
Contributor

evanmcc commented Jun 29, 2013

Read over the code on friday, looks good, as noted, some nice use of metaprogramming going on there. Going to do a final pass and some testing on monday.

@hazen
Copy link

hazen commented Jun 30, 2013

Verified Sean's errors against 1.3.1:

ERROR: test_disable_search_commit_hook (riak.tests.test_all.RiakPbcTransportTestCase)
NotImplementedError: Server only supports n_val and allow_mult properties over PBC
======================================================================
ERROR: test_enable_search_commit_hook (riak.tests.test_all.RiakPbcTransportTestCase)
NotImplementedError: Server only supports n_val and allow_mult properties over PBC
======================================================================
ERROR: test_primary_quora (riak.tests.test_all.RiakPbcTransportTestCase)
KeyError: 'pr'
======================================================================
ERROR: test_rw_settings (riak.tests.test_all.RiakPbcTransportTestCase)
KeyError: 'r'
======================================================================
FAIL: test_clear_bucket_properties (riak.tests.test_all.RiakPbcTransportTestCase)
AssertionError: False is not true

@hazen
Copy link

hazen commented Jun 30, 2013

Tested against 1.4.0rc1 and it looks good:

----------------------------------------------------------------------
Ran 208 tests in 31.445s

OK

@seancribbs
Copy link
Author

Thanks @javajolt, I'll merge late this morning unless @evanmcc has objections.

seancribbs pushed a commit that referenced this pull request Jul 1, 2013
Riak 1.4 Feature: Protocol Buffers Bucket Properties
@seancribbs seancribbs merged commit 3c5df47 into master Jul 1, 2013
@seancribbs seancribbs deleted the gh256-1.4-bucket-props branch July 1, 2013 16:32
@seancribbs seancribbs removed their assignment May 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants