ocket8888 commented on a change in pull request #5328:
URL: https://github.com/apache/trafficcontrol/pull/5328#discussion_r535728877
##########
File path: traffic_ops/traffic_ops_golang/server/servers_assignment.go
##########
@@ -62,77 +62,141 @@ func getConfigFile(prefix string, xmlId string) string {
return prefix + xmlId + configSuffix
}
+const lastServerInActiveDeliveryServicesQuery = `
+SELECT deliveryservice_server.deliveryservice
+FROM deliveryservice_server
+INNER JOIN server ON server.id = deliveryservice_server.server
+INNER JOIN status ON status.id = server.status
+WHERE deliveryservice IN (
+ SELECT deliveryservice_server.deliveryservice
+ FROM deliveryservice_server
+ INNER JOIN deliveryservice ON deliveryservice.id =
deliveryservice_server.deliveryservice
+ WHERE deliveryservice_server.server=$1
+ AND deliveryservice.active IS TRUE
+)
+AND NOT (deliveryservice_server.deliveryservice = ANY($2::BIGINT[]))
+AND (status.name = 'ONLINE' OR status.name = 'REPORTED')
+GROUP BY deliveryservice_server.deliveryservice
+HAVING COUNT(deliveryservice_server.server) = 1
+`
+
+func checkForLastServerInActiveDeliveryServices(serverID int, dsIDs []int, tx
*sql.Tx) ([]int, error) {
+ log.Debugf("TEST: checking last server #%d in DSes: %v", serverID,
dsIDs)
Review comment:
lol no. my bad
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]