-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Async execution, ResultSet paging, and NoHostAvailableException #29
Comments
Hi Derek, Good catch! While this is true that in the -chan and -async this is would be relatively rare, this is something that had to be fixed. About chan-buffered, you're perfectly right, but in practise it's often more convenient to use one of the other functions, I think having multiple options is the way to go. I am still waiting for promise-chan to eventually be released in core.async to replace some of the -chan machinery, but I am not holding my breath anymore... Your PR didn't include the fix for the manifold interface, that would be welcomed too (the lamina interface is going away on the next release, no need to bother). Thanks a lot, Max |
No worries Max, there you go. |
Issue #29, NoHostAvailableException. Lamina and Manifold modifications
Thanks again. It's on clojars as 2.5.3 |
The datastax java driver pages results with a default fetch-size of 5000.
If the cluster is unavailable as the ResultSet requests the next page of results a NoHostAvailableException is thrown, there's a ticket to make paging resumable (https://datastax-oss.atlassian.net/browse/JAVA-277), but there will always be a possibility of this exception being thrown.
As much as it is unlikely to occur, there are two broad implications:
In the case of -async and -chan there's only a vanishingly small window of triggering the latter case, fetch-size needs to be less than thunk-size which is probably a misconfiguration anyway. You're more likely to encounter this case when using -chan-buffered and paging through large amounts of data when a network partition occurs, then you end up waiting on a channel which will never close.
We use ccm (https://github.com/SMX-LTD/ccm-clj) for stopping/starting clusters while testing and I've been able to reproduce both cases for -chan and -chan-buffered by executing a query and stopping the cluster temporarily, I'll raise a PR which addresses it, the only further thing to add is consumers of a -chan-buffered execution result should know an exception may be placed on the channel at any time, even after some results have been successfully returned.
I feel like -chan-buffered is the most 'correct' implementation of the core.async way of querying C* and maybe should replace -chan?
The text was updated successfully, but these errors were encountered: