Comcast / sirius

A distributed system library for managing application reference data
http://comcast.github.io/sirius/
Apache License 2.0
298 stars 49 forks source link

PaxosStateBridge does not propagate SiriusResults from the RequestHandler #6

Open comcast-jonm opened 10 years ago

comcast-jonm commented 10 years ago

Currently, when the PaxosStateBridge receives a Paxos decision, it acks the update back to the originating client with a SiriusResult.none() before that update has been persisted or applied to the brain via the RequestHandler. This means there is no way to tell if an exception was thrown while trying to apply it, and there is no way to have a return value from the RequestHandler's enqueuePut or enqueueDelete methods.

Possible solutions:

smuir commented 10 years ago

In the course of hacking up a prototype 'tagged' interface, I came up with a workaround for this problem. It is similar to the first suggestion Jon suggested, in that it passes back the handler function return value, but does so by adding a Promise to the request (in the same way as the tag object) and using the return value to complete the Promise. It works, and is easy to understand, but might be violating the actor model by short-circuiting a value directly rather than sending a message.

[On further thought I think this is a dumb idea, not only for the argument raised above but also because I'm not sure Akka wants you to pass 'complex' objects like Promise around]

smuir commented 10 years ago

A quick eyeball of the code suggests that implementing Jon's first suggestion might require nothing more than deleting the line where 'SiriusResult.none' is sent back by the PaxosStateHandler. Is there any reason not to just do that?