You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2021/03/19 18:01:53 UTC

[trafficcontrol] 05/08: Remove crconfig generation warning for topology-based DSes (#5654)

This is an automated email from the ASF dual-hosted git repository.

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

commit 6dbce7b40d43d5d5b3d58bda495d12768db0ce74
Author: Rawlin Peters <ra...@apache.org>
AuthorDate: Thu Mar 18 08:49:06 2021 -0600

    Remove crconfig generation warning for topology-based DSes (#5654)
    
    (cherry picked from commit 2a9229ed3d88c82305e326a69e40fd583c859202)
---
 CHANGELOG.md                                       | 1 +
 traffic_ops/traffic_ops_golang/crconfig/servers.go | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9510d72..2dc9946 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#5565](https://github.com/apache/trafficcontrol/issues/5565) - TO GET /caches/stats panic converting string to uint64
 - [#5558](https://github.com/apache/trafficcontrol/issues/5558) - Fixed `TM UI` and `/api/cache-statuses` to report aggregate `bandwidth_kbps` correctly.
 - Fix for config gen missing max_origin_connections on mids in certain scenarios
+- [#5192](https://github.com/apache/trafficcontrol/issues/5192) - Fixed TO log warnings when generating snapshots for topology-based delivery services.
 - Fixed Invalid TS logrotate configuration permissions causing TS logs to be ignored by logrotate.
 
 ## [5.1.0] - 2021-02-21
diff --git a/traffic_ops/traffic_ops_golang/crconfig/servers.go b/traffic_ops/traffic_ops_golang/crconfig/servers.go
index 2d1112a..bba5838 100644
--- a/traffic_ops/traffic_ops_golang/crconfig/servers.go
+++ b/traffic_ops/traffic_ops_golang/crconfig/servers.go
@@ -327,8 +327,9 @@ order by dsr.set_number asc
 	hostReplacer := strings.NewReplacer(`\`, ``, `.*`, ``)
 
 	dsInfs := map[string][]DSRouteInfo{}
-	var hasTopology bool
+	dsHasTopology := make(map[string]bool)
 	for rows.Next() {
+		hasTopology := false
 		ds := ""
 		dsType := ""
 		dsPattern := ""
@@ -337,6 +338,7 @@ order by dsr.set_number asc
 		if err := rows.Scan(&ds, &dsType, &dsRoutingName, &dsPattern, &hasTopology); err != nil {
 			return nil, errors.New("Error scanning server deliveryservices: " + err.Error())
 		}
+		dsHasTopology[ds] = hasTopology
 		// Topology-based delivery services do not use the contentServers.deliveryServices field
 		if hasTopology {
 			continue
@@ -361,7 +363,7 @@ order by dsr.set_number asc
 		for _, dsName := range dses {
 			dsInfList, ok := dsInfs[string(dsName)]
 			if !ok {
-				if !hasTopology {
+				if !dsHasTopology[string(dsName)] {
 					log.Warnln("Creating CRConfig: deliveryservice " + string(dsName) + " has no regexes, skipping")
 				}
 				continue