rawlinp commented on a change in pull request #1908: Changes for Backup Edge 
Cache Group
URL: 
https://github.com/apache/incubator-trafficcontrol/pull/1908#discussion_r172611695
 
 

 ##########
 File path: 
traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/router/TrafficRouter.java
 ##########
 @@ -675,17 +678,40 @@ public CacheLocation getCoverageZoneCacheLocation(final 
String ip, final String
                        return cacheLocation;
                }
 
-               // We had a hit in the CZF but the name does not match a known 
cache location.
-               // Check whether the CZF entry has a geolocation and use it if 
so.
-               return 
getClosestCacheLocation(cacheRegister.filterAvailableLocations(deliveryServiceId),
 networkNode.getGeolocation(), 
cacheRegister.getDeliveryService(deliveryServiceId));
+               if (networkNode.getBackupCacheGroups() != null) {
+                       for (final String cacheGroup : 
networkNode.getBackupCacheGroups()) {
+                               final CacheLocation bkCacheLocation = 
getCacheRegister().getCacheLocationById(cacheGroup);
+                               if (bkCacheLocation != null && 
!getSupportingCaches(bkCacheLocation.getCaches(), deliveryService).isEmpty()) {
+                                       LOGGER.debug("Got backup CZ cache group 
" + bkCacheLocation.getId() + " for " + ip + ", ds " + deliveryServiceId);
+                                       if (track != null) {
+                                               
track.setFromBackupCzGroup(true);
+                                       }
+                                       return bkCacheLocation;
+                               }
+                       }
+               } 
+
+               if (networkNode.isUseClosest()) {
+                       // We had a hit in the CZF but the name does not match 
a known cache location.
+                       // Check whether the CZF entry has a geolocation and 
use it if so.
+                       final CacheLocation closestCacheLocation = 
getClosestCacheLocation(cacheRegister.filterAvailableLocations(deliveryServiceId),
 networkNode.getGeolocation(), 
cacheRegister.getDeliveryService(deliveryServiceId));
+                       if (closestCacheLocation != null) {
+                               LOGGER.debug("Got closest CZ cache group " + 
closestCacheLocation.getId() + " for " + ip + ", ds " + deliveryServiceId);
+                               if (track != null) {
+                                       track.setFromBackupCzGroup(true);
+                               }
+                       }
+                       return closestCacheLocation;
+               }
+               return null;
 
 Review comment:
   Geo is generally the backup case when a client's IP cannot be found in the 
CZF. If the client is found in the CZF, we shouldn't be falling back to a 
Geo-lookup which subverts the CZF's `backupZones` config. We know the client is 
in our network, so we want it to follow the rules specified in the CZF.
   
   If the client was _not_ found in the CZF, then it should most likely _not_ 
be in our network. In that case, the congestion might not be a problem because 
the client should be entering our network from somewhere else.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to