You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/06/07 13:27:47 UTC

[GitHub] Vijay-1 commented on a change in pull request #2029: [Issue 1907] TO API for backup edge cachegroup

Vijay-1 commented on a change in pull request #2029: [Issue 1907] TO API for backup edge cachegroup
URL: https://github.com/apache/incubator-trafficcontrol/pull/2029#discussion_r193745582
 
 

 ##########
 File path: traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/router/TrafficRouter.java
 ##########
 @@ -716,17 +722,44 @@ public CacheLocation getCoverageZoneCacheLocation(final String ip, final String
 			return cacheLocation;
 		}
 
+		if (cacheLocation != null && cacheLocation.getBackupCacheGroups() != null) {
+			for (final String cacheGroup : cacheLocation.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;
+				}
+			}
+			// track.continueGeo
+			// will become to false only when backups are configured and (primary group's) fallbackToClosedGeo is configured (non-empty list) to false
+			// False signals subsequent cacheSelection routine to stop geo based selection.
+			if (!cacheLocation.isUseClosestGeoLoc()) {
+			    track.continueGeo = false;
+			    return null;
+			}
+		} 
+
 		// 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));
+		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);
 
 Review comment:
   The cache which gets selected in this cache is not a primary one. This is again a backup cache configured via Coordinates and hence it gets tracked as backup.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services