masaori335 commented on code in PR #13368:
URL: https://github.com/apache/trafficserver/pull/13368#discussion_r3725183536


##########
src/proxy/ParentConsistentHash.cc:
##########
@@ -151,6 +151,14 @@ ParentConsistentHash::selectParent(bool first_call, 
ParentResult *result, Reques
   HostStatus                &pStatus   = HostStatus::instance();
   TSHostStatus               host_stat = TSHostStatus::TS_HOST_STATUS_INIT;
 
+  // Bound the all-down ring walk: read each distinct parent's status at most 
once.
+  // Sized to the pool -- num_parents is not capped at MAX_PARENTS, so a fixed 
array would overflow.
+  int const         num_parents_in_ring[2] = {result->rec->num_parents, 
result->rec->num_secondary_parents};
+  std::vector<bool> seen_parent[2]         = 
{std::vector<bool>(num_parents_in_ring[PRIMARY]),
+                                              
std::vector<bool>(num_parents_in_ring[SECONDARY])};

Review Comment:
   Changed to use `ts::LocalBuffer` by 
`[dab31ac](https://github.com/apache/trafficserver/pull/13368/commits/dab31acf1c0338dcd74d603cf85bbb08fdcafe90)`
 



##########
src/proxy/ParentConsistentHash.cc:
##########
@@ -151,6 +151,14 @@ ParentConsistentHash::selectParent(bool first_call, 
ParentResult *result, Reques
   HostStatus                &pStatus   = HostStatus::instance();
   TSHostStatus               host_stat = TSHostStatus::TS_HOST_STATUS_INIT;
 
+  // Bound the all-down ring walk: read each distinct parent's status at most 
once.
+  // Sized to the pool -- num_parents is not capped at MAX_PARENTS, so a fixed 
array would overflow.
+  int const         num_parents_in_ring[2] = {result->rec->num_parents, 
result->rec->num_secondary_parents};
+  std::vector<bool> seen_parent[2]         = 
{std::vector<bool>(num_parents_in_ring[PRIMARY]),
+                                              
std::vector<bool>(num_parents_in_ring[SECONDARY])};

Review Comment:
   Changed to use `ts::LocalBuffer` by dab31acf1c0338dcd74d603cf85bbb08fdcafe90



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to