Skip to content

Commit e383572

Browse files
author
vimes
committed
Fix balancer wrr service ring partitioning
1 parent d081000 commit e383572

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dataplane/globalbase.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,13 @@ generation::ServiceSize generation::rebuild_service_ring_one_wrr(
18541854
const balancer_service_t& service)
18551855
{
18561856
balancer_real_id_t* end = start;
1857-
balancer_real_id_t* reserve = start + YANET_BALANCER_WRR_SERVICE_SIZE;
1857+
const auto service_size = service.real_size * YANET_CONFIG_BALANCER_REAL_WEIGHT_MAX;
1858+
balancer_real_id_t* reserve = start + service_size;
1859+
if (reserve > do_not_exceed)
1860+
{
1861+
reserve = do_not_exceed;
1862+
YANET_LOG_ERROR("Balancer exceeded service ring size. Service ring chunck clamped to limit.\n");
1863+
}
18581864
for (uint32_t real_idx = service.real_start;
18591865
real_idx < service.real_start + service.real_size;
18601866
++real_idx)

0 commit comments

Comments
 (0)