API Design Choices - Sharding Status for Failure Scenarios
Join the DZone community and get the full member experience.Join For Free
this post conclude this week’ series of api design choices regarding how to handle partial failure scenarios in sharded cluster. in my previous post , i discussed my issues with a local solution for the problem.
the way we ended up solving this issue is actually quite simple. we apply a global solution to a global problem, we added the ability to inject error handling logic deep into the execution pipeline of the sharding implementation, like this:
in this case, as you can see, we are allow requests to fail if we are querying (because we can probably still get something from other servers that will be useful), but if you are requesting something by id and it generates an error, we will propagate this error. note that in our implementation, we call to a user defined “notifyuserinterfaceaboutserverfailure”, which will let the user know about the error.
that way, you probably have some warning in the ui about partial information, but you are still functional. this is the proper way to handle this, because you are handling this once , and it means that you can handle it properly , instead of having to do the right thing everywhere.
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.