-
Notifications
You must be signed in to change notification settings - Fork 357
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
[QUESTION] Cluster slots polling #561
Comments
Once you create an AsyncRedisCluster object, it begins to fetch the slot-node mapping.
YES
You should catch the exception. B.T.W. I'ved fixed the slot uncovered problem, and you can update your code and try it again. Check this issue for detail. Regards |
Hello, On my understanding this exception was handled internally in the library code and it was not rethrown in 1.3.10 release of the library. As a result this is not something I can handle on the client side. However, I did repeat the test using 1.3.12 and I am still getting an abort signal. Based on the backtrace I can see the following:
This time I am getting a SlotUncoveredError exception. It seems that slot 15342 which maps to node-2 is not handled properly, probably because the cluster setup is not yet known to the library. Please note that upon respawn the operation succeeds without problem. I noticed a comment in the library code regarding this SlotUncoveredError. Could the fact that an async update is called in this case be related to my error? |
Hello, Related to this topic, how the library behaves when the Redis cluster setup is in progress (the hash slotting is still in progress at Redis side). Should library send periodically a cluster info command so as to understand that cluster setup is finished and DB is ready for operations? Or should the DB clients do so. In this case, is 'cluster info' command supported by the library? Thank you, |
I added on the client side a polling "CLUSTER INFO" command (using generic command interface) which blocks until the cluster setup is complete (i.e assigned slots 16384). "CLUSTER INFO: cluster_state:ok\r\ncluster_slots_assigned:16384\r\ncluster_slots_ok:16384\r\ncluster_slots_pfail:0\r\ncluster_slots_fail:0\r\ncluster_known_nodes:3\r\ncluster_size:3\r\ncluster_current_epoch:2\r\ncluster_my_epoch:0\r\ncluster_stats_messages_ping_sent:227\r\ncluster_stats_messages_pong_sent:218\r\ncluster_stats_messages_sent:445\r\ncluster_stats_messages_ping_received:217\r\ncluster_stats_messages_pong_received:227\r\ncluster_stats_messages_meet_received:1\r\ncluster_stats_messages_received:445\r\n" Again, I see the same exception. "terminate called after throwing an instance of 'sw::redis::SlotUncoveredError'"}} The question is, given that the hash slots readiness can take some time to complete, does the library get notified somehow, about the final hash slots setup? Can you please help me identify the reason I might getting this error? |
@mike1821 Sorry, but I cannot reproduce your problem. If you catch the exception, your application should not terminate. Please try the following code:
I manually removed the slots where key b located from the cluster. With latest redis-plus-plus, the above code prints the following message without terminating:
|
@georgasa So far, redis-plus-plus tries to fetch the slot-node mapping once the AsyncRedisCluster is created. However, it only checks if it can get the mapping, but does not check if all slots have been covered by the mapping. Your scenario is an edge case, I'll take a look on how to fix it. |
With #595 fix, redis-plus-plus updates slot-node mapping periodically, and I think problems in this issue should be solved. I'll close this issue, if you still have problem with it, feel free to reopen it. Regards |
Hello,
I am using an async cluster object to establish a connection towards one of the master nodes (0).
The first time I am trying to interact with the database I am getting the following exception.
I know that redis++ initiates a polling thread in order to monitor the cluster sharding. My question is when does this operation start? Is it upon a successful connection or after a command? Or something different.
I am assuming that when the initial connection occurs cluster is not ready. However the setup completes after a while. Given that the cluster has been setup correctly after some time, would the library update the cluster map internally?
Could you please propose a way to correctly handle this exception? Currently is causing SIGABRT on the client side.
Environment:
OS: Rocky Linux
Compiler: g++ 8.5.0
hiredis version: v1.0.0, master]
redis-plus-plus version: 1.3.10
The text was updated successfully, but these errors were encountered: