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


##########
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:
   I don't like the allocation here.  Consider using ts::LocalBuffer or 
swoop::Vectray instead to try to avoid heap allocation here.



-- 
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