[HA-JDBC] Changing the weight of an active database
High-Availability JDBC
Brought to you by:
ferraro
From: Steve J. <ste...@eu...> - 2013-08-08 19:24:52
|
In our usage of HA-JDBC we are using the simple balancer type to direct requests to the node with the highest weight. At runtime nodes can be activated and deactivated and we want to be able to change the node weights to direct traffic to the "primary" node. For example, we may start off with: Node A : weight 2 Node B : weight 1 If node A is deactivated, we would want the nodes to be: Node B : weight 2 so any nodes activated subsequently will have lower weights. At the moment we would have to deactivate B in order to change the weight. >From a very quick review it looks as though it is safe to change the weight when active so I am wondering if this is a valid use case for which I could submit a pull request. As far as implementation goes I assume that if the weight could be changed when active then the dirty flag should not be set and the weight field should be declared volatile. Thanks, Steve |