You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "thswlsqls (via GitHub)" <gi...@apache.org> on 2026/09/29 04:34:10 UTC
[I] WEIGHT load balancer applies stale weights when read data sources are swapped [shardingsphere]
thswlsqls opened a new issue, #39992:
URL: https://github.com/apache/shardingsphere/issues/39992
## Bug Report
### Which version of ShardingSphere did you use?
master @ 28ee19118f9
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
Both (cluster mode)
### Expected behavior
`WEIGHT` distributes reads by the configured weights of the available read data sources.
### Actual behavior
When the available set changes to a different set of the same size, the previous set's weights are applied by position. With `read_ds_0=1, read_ds_1=1, read_ds_2=8`, routing `[read_ds_0, read_ds_2]` then `[read_ds_0, read_ds_1]` silently sends about 89% of reads to `read_ds_1` instead of 50% until the list size changes again.
### Reason analyze (If you can)
`WeightLoadBalanceAlgorithm.getTargetName()` reuses the cached cumulative weights per group whenever the cached array length equals `availableTargetNames.size()`. #21602 invalidated the cache only when the size changes; target names are not compared.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
1. Cluster mode, readwrite-splitting group with three read data sources and `WEIGHT`.
2. Disable `read_ds_1`, run a read query.
3. Enable `read_ds_1` and disable `read_ds_2` with no read on that group in between.
4. `read_ds_1` now receives `read_ds_2`'s weight.
### Example codes for reproduce this issue (such as a github link).
N/A
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] WEIGHT load balancer applies stale weights when read data sources are swapped [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #39992: WEIGHT load balancer applies stale weights when read data sources are swapped
URL: https://github.com/apache/shardingsphere/issues/39992
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org