trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ocket8...@apache.org
Subject [trafficcontrol] branch master updated: Fix ORT Max Origin Connections for Mids (#4938)
Date Tue, 11 Aug 2020 17:05:07 GMT
This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 8f14980  Fix ORT Max Origin Connections for Mids (#4938)
8f14980 is described below

commit 8f14980436a12425c2081e3320f3bc21ebfd7e81
Author: Robert O Butts <rob05c@users.noreply.github.com>
AuthorDate: Tue Aug 11 11:04:53 2020 -0600

    Fix ORT Max Origin Connections for Mids (#4938)
    
    It wasn't filtering DeliveryServiceServers, resulting in all servers
    with parents being included. Fixed to filter correctly.
---
 CHANGELOG.md                                            |  1 +
 .../atstccfg/cfgfile/headerrewritemiddotconfig.go       | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e14329d..e47f1ce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - Fixed update procedure of servers, so that if a server is linked to one or more delivery
services, you cannot change its "cdn". [Related github issue](https://github.com/apache/trafficcontrol/issues/4116)
 - Fixed `POST /api/x/steering` and `PUT /api/x/steering` so that a steering target with an
invalid `type` is no longer accepted. [Related github issue](https://github.com/apache/trafficcontrol/issues/3531)
 - Fixed `cachegroups` READ endpoint, so that if a request is made with the `type` specified
as a non integer value, you get back a `400` with error details, instead of a `500`. [Related
github issue](https://github.com/apache/trafficcontrol/issues/4703)
+- Fixed ORT bug miscalculating Mid Max Origin Connections as all servers, usually resulting
in 1.
 - Added Delivery Service Raw Remap `__RANGE_DIRECTIVE__` directive to allow inserting the
Range Directive after the Raw Remap text. This allows Raw Remaps which manipulate the Range.
 - Added an option for `coordinateRange` in the RGB configuration file, so that in case a
client doesn't have a postal code, we can still determine if it should be allowed or not,
based on whether or not the latitude/ longitude of the client falls within the supplied ranges.
[Related github issue](https://github.com/apache/trafficcontrol/issues/4372)
 
diff --git a/traffic_ops_ort/atstccfg/cfgfile/headerrewritemiddotconfig.go b/traffic_ops_ort/atstccfg/cfgfile/headerrewritemiddotconfig.go
index e3bfec9..2f0b3e3 100644
--- a/traffic_ops_ort/atstccfg/cfgfile/headerrewritemiddotconfig.go
+++ b/traffic_ops_ort/atstccfg/cfgfile/headerrewritemiddotconfig.go
@@ -24,6 +24,7 @@ import (
 	"strings"
 
 	"github.com/apache/trafficcontrol/lib/go-atscfg"
+	"github.com/apache/trafficcontrol/lib/go-log"
 	"github.com/apache/trafficcontrol/lib/go-tc"
 	"github.com/apache/trafficcontrol/traffic_ops_ort/atstccfg/config"
 )
@@ -52,11 +53,25 @@ func GetConfigFileCDNHeaderRewriteMid(toData *config.TOData, fileName
string) (s
 		return "", "", "", errors.New("converting ds to config ds: " + err.Error())
 	}
 
+	assignedServers := map[int]struct{}{}
+	for _, dss := range toData.DeliveryServiceServers {
+		if dss.Server == nil || dss.DeliveryService == nil {
+			continue
+		}
+		if *dss.DeliveryService != *tcDS.ID {
+			continue
+		}
+		assignedServers[*dss.Server] = struct{}{}
+	}
+
 	serverCGs := map[tc.CacheGroupName]struct{}{}
 	for _, sv := range toData.Servers {
 		if sv.CDNName != toData.Server.CDNName {
 			continue
 		}
+		if _, ok := assignedServers[sv.ID]; !ok && (tcDS.Topology == nil || *tcDS.Topology
== "") {
+			continue
+		}
 		if tc.CacheStatus(sv.Status) != tc.CacheStatusReported && tc.CacheStatus(sv.Status)
!= tc.CacheStatusOnline {
 			continue
 		}
@@ -100,5 +115,7 @@ func GetConfigFileCDNHeaderRewriteMid(toData *config.TOData, fileName
string) (s
 		assignedMids = append(assignedMids, cfgServer)
 	}
 
+	log.Infof("MakeHeaderRewriteMidDotConfig ds "+*tcDS.XMLID+" got mids %+v\n", len(assignedMids))
+
 	return atscfg.MakeHeaderRewriteMidDotConfig(tc.CDNName(toData.Server.CDNName), toData.TOToolName,
toData.TOURL, cfgDS, assignedMids), atscfg.ContentTypeHeaderRewriteDotConfig, atscfg.LineCommentHeaderRewriteDotConfig,
nil
 }


Mime
View raw message