Kinetic / kinetic-protocol

34 stars 21 forks source link

synchronization behavior for invalid params #33

Closed pareshpp closed 9 years ago

pareshpp commented 9 years ago

What is the difference between errors thrown for synchronization=False and synchronization=-1?

c = Client('localhost', 8123) c.connect() c.put('message','hello world', force="false", synchronization=False) Traceback (most recent call last): File "", line 1, in File "/kinetic-py/kinetic-py/kinetic/deprecated/blockingclient.py", line 60, in put return self._process(operations.Put(), _args, _kwargs) File "/kinetic-py/kinetic-py/kinetic/baseasync.py", line 165, in _process return super(BaseAsync, self)._process(op, _args, _kwargs) File "/kinetic-py/kinetic-py/kinetic/deprecated/blockingclient.py", line 54, in _process return op.onError(e) File "/kinetic-py/kinetic-py/kinetic/operations.py", line 110, in onError raise e kinetic.common.KineticMessageException: INVALID_REQUEST: Persistent synchronization option must be set to a valid value c.put('message','hello world', force="false", synchronization=-1) Traceback (most recent call last): File "", line 1, in File "/kinetic-py/kinetic-py/kinetic/deprecated/blockingclient.py", line 60, in put return self._process(operations.Put(), _args, _kwargs) File "/kinetic-py/kinetic-py/kinetic/baseasync.py", line 165, in _process return super(BaseAsync, self)._process(op, _args, _kwargs) File "/kinetic-py/kinetic-py/kinetic/deprecated/blockingclient.py", line 54, in _process return op.onError(e) File "/kinetic-py/kinetic-py/kinetic/operations.py", line 110, in onError raise e kinetic.common.KineticMessageException: INVALID_REQUEST: Invalid persistent synchronization option: INVALID_SYNCHRONIZATION

icorderi commented 9 years ago

@pareshpp in general kinetic protocol terms, a -1 value is invalid and you should not be passing those.

There are also a few python issues:

c.put('message','hello world', force="false", synchronization=False) # wrong

The correct use would be:

c.put('message','hello world', force=False, synchronization=Synchronization.WRITEBACK)
// or
c.put('message','hello world')

These two are the same because force=False and synchronization=WRITEBACK are the default values.