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 2021/04/08 23:04:55 UTC

[GitHub] [trafficcontrol] zrhoffman opened a new pull request #5725: Generate XMPPID on server update if it is empty

zrhoffman opened a new pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725


   <!--
   ************ STOP!! ************
   If this Pull Request is intended to fix a security vulnerability, DO NOT submit it! Instead, contact
   the Apache Software Foundation Security Team at security@trafficcontrol.apache.org and follow the
   guidelines at https://www.apache.org/security/ regarding vulnerability disclosure.
   -->
   ## What does this PR (Pull Request) do?
   <!-- Explain the changes you made here. If this fixes an Issue, identify it by
   replacing the text in the checkbox item with the Issue number e.g.
   
   - [x] This PR fixes #9001 OR is not related to any Issue
   
   ^ This will automatically close Issue number 9001 when the Pull Request is
   merged (The '#' is important).
   
   Be sure you check the box properly, see the "The following criteria are ALL
   met by this PR" section for details.
   -->
   
   - [x] This PR fixes #5724 by setting the XMPPID field on update if it is empty<!-- You can check for an issue here: https://github.com/apache/trafficcontrol/issues -->
   
   This PR also adds a migration to generate UUIDs for each server in the database for which the `xmpp_id` field is empty.
   
   ## Which Traffic Control components are affected by this PR?
   <!-- Please delete all components from this list that are NOT affected by this
   Pull Request. Also, feel free to add the name of a tool or script that is
   affected but not on the list.
   
   Additionally, if this Pull Request does NOT affect documentation, please
   explain why documentation is not required. -->
   - Traffic Ops
   
   ## What is the best way to verify this PR?
   <!-- Please include here ALL the steps necessary to test your Pull Request. If
   it includes tests (and most should), outline here the steps needed to run the
   tests. If not, lay out the manual testing procedure and please explain why
   tests are unnecessary for this Pull Request. -->
   - Run the TO API tests
   - Running an SQL query directly against the database, set the XMPPID for a server to NULL or an empty string, then try updating it using Traffic Portal
   
   ## If this is a bug fix, what versions of Traffic Control are affected?
   <!-- If this PR fixes a bug, please list here all of the affected versions - to
   the best of your knowledge. It's also pretty helpful to include a commit hash
   of where 'master' is at the time this PR is opened (if it affects master),
   because what 'master' means will change over time. For example, if this PR
   fixes a bug that's present in master (at commit hash '1df853c8'), in v4.0.0,
   and in the current 4.0.1 Release candidate (e.g. RC1), then this list would
   look like:
   
   - master (1df853c8)
   - 4.0.0
   - 4.0.1 (RC1)
   
   If you don't know what other versions might have this bug, AND don't know how
   to find the commit hash of 'master', then feel free to leave this section
   blank (or, preferably, delete it entirely).
    -->
   - master (4e8e3bab98)
   
   ## The following criteria are ALL met by this PR
   <!-- Check the boxes to signify that the associated statement is true. To
   "check a box", replace the space inside of the square brackets with an 'x'.
   e.g.
   
   - [ x] <- Wrong
   - [x ] <- Wrong
   - [] <- Wrong
   - [*] <- Wrong
   - [x] <- Correct!
   
   -->
   
   - [x] This PR includes tests
   - [x] Bugfix, documentation is unnecessary
   - [x] This PR includes an update to CHANGELOG.md
   - [x] This PR includes any and all required license headers
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   
   


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



[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610197559



##########
File path: traffic_ops/app/db/migrations/2021040819481469_generate_uuid_for_xmpp_id_where_empty.sql
##########
@@ -0,0 +1,23 @@
+/*
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+-- +goose Up
+-- SQL in section 'Up' is executed when this migration is applied
+CREATE EXTENSION pgcrypto; /* Loads pgcrypto if gen_random_uuid() does not already exist */
+UPDATE "server" s set xmpp_id = gen_random_uuid() WHERE s.xmpp_id IS NULL OR s.xmpp_id = '';

Review comment:
       Setting XMPPID to hostname for the migration in 0cb43fea0c




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



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610890625



##########
File path: CHANGELOG.md
##########
@@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#5405](https://github.com/apache/trafficcontrol/issues/5405) - Prevent Tenant update from choosing child as new parent
 - [#5384](https://github.com/apache/trafficcontrol/issues/5384) - New grids will now properly remember the current page number.
 - [#5548](https://github.com/apache/trafficcontrol/issues/5548) - Don't return a `403 Forbidden` when the user tries to get servers of a non-existent DS using `GET /servers?dsId={{nonexistent DS ID}}`
+- [#5724](https://github.com/apache/trafficcontrol/issues/5724) - Generate XMPPID on update if the server had none

Review comment:
       Since this PR no longer generates UUIDs for XMPPID, we should probably say `Set XMPPID to hostname if the server had none, don't error on server update when XMPPID is empty`.
   
   Also, would the title would make more sense now as "Set server XMPPID to hostname if empty"?




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



[GitHub] [trafficcontrol] rawlinp commented on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rawlinp commented on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816829653


   > A poorly named property of a server used by Traffic Router for consistent hashing. On create, this is set to a UUID, however, legacy behaviour would use server hostname if this value was undefined.
   
   This is pretty good, but I would add that it's an _immutable_ property.


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



[GitHub] [trafficcontrol] mitchell852 edited a comment on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
mitchell852 edited a comment on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816817394


   there is some incorrect documentation regarding XMPPID. want to fix that too? lots of this:
   
   ```
   xmppId
   An identifier to be used in XMPP communications with the server - in nearly all cases this will be the same as hostName
   ```
   
   a better description may be something like:
   
   ```
   xmppId
   A poorly named property of a server used by Traffic Router for consistent hashing. On create, this is set to a UUID, however, legacy behaviour would use server hostname if this value was undefined.
   ```
   
   ^^ Pretty sure I got that wrong. Maybe @rawlinp has a better definition.


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



[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610771459



##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -1638,7 +1640,11 @@ func Update(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	if server.XMPPID != nil && *server.XMPPID != originalXMPPID {
+	if server.XMPPID == nil || *server.XMPPID == "" {
+		log.Infof("Found empty XMPPID for server %s, setting random XMPPID", *server.HostName)
+		server.XMPPID = newUUID()

Review comment:
       Not setting XMPPID in an update in cb1b9976cc.




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



[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610197559



##########
File path: traffic_ops/app/db/migrations/2021040819481469_generate_uuid_for_xmpp_id_where_empty.sql
##########
@@ -0,0 +1,23 @@
+/*
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+-- +goose Up
+-- SQL in section 'Up' is executed when this migration is applied
+CREATE EXTENSION pgcrypto; /* Loads pgcrypto if gen_random_uuid() does not already exist */
+UPDATE "server" s set xmpp_id = gen_random_uuid() WHERE s.xmpp_id IS NULL OR s.xmpp_id = '';

Review comment:
       Setting XMPPID to hostname for the migration in 0cb43fea0c.




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



[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #5725: Set server XMPPID to hostname if empty

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610892943



##########
File path: CHANGELOG.md
##########
@@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#5405](https://github.com/apache/trafficcontrol/issues/5405) - Prevent Tenant update from choosing child as new parent
 - [#5384](https://github.com/apache/trafficcontrol/issues/5384) - New grids will now properly remember the current page number.
 - [#5548](https://github.com/apache/trafficcontrol/issues/5548) - Don't return a `403 Forbidden` when the user tries to get servers of a non-existent DS using `GET /servers?dsId={{nonexistent DS ID}}`
+- [#5724](https://github.com/apache/trafficcontrol/issues/5724) - Generate XMPPID on update if the server had none

Review comment:
       Updated PR title and updated changelog entry in 04f137b767.




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



[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610885456



##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -1459,10 +1460,8 @@ func Update(w http.ResponseWriter, r *http.Request) {
 	}
 
 	original := originals[0]
-	if original.XMPPID == nil {
-		sysErr = errors.New("original server had no XMPPID")
-		api.HandleErr(w, r, tx, http.StatusInternalServerError, nil, sysErr)
-		return
+	if original.XMPPID == nil || *original.XMPPID == "" {
+		log.Warnln("original server had no XMPPID")

Review comment:
       Including the hostname in the warning in 034ad01440.




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



[GitHub] [trafficcontrol] rawlinp commented on pull request #5725: Set server XMPPID to hostname if empty

Posted by GitBox <gi...@apache.org>.
rawlinp commented on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816982701


   Also if this PR is considered for backporting to a release branch, the backport should _not_ include the DB migration. The code fix alone should be sufficient for fixing the bug.


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



[GitHub] [trafficcontrol] mitchell852 edited a comment on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
mitchell852 edited a comment on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816817394


   there is some incorrect documentation regarding XMPPID. want to fix that too? lots of this:
   
   ```
   xmppId
   An identifier to be used in XMPP communications with the server - in nearly all cases this will be the same as hostName
   ```


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



[GitHub] [trafficcontrol] rimashah25 commented on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816898945


   > there is some incorrect documentation regarding XMPPID. want to fix that too? lots of this:
   > 
   > ```
   > xmppId
   > An identifier to be used in XMPP communications with the server - in nearly all cases this will be the same as hostName
   > ```
   
   Isn't that part of v1 docs.. soon to go away? I checked the codebase otherwise and couldn't find the above mention in any other documentation.


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



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610850861



##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -443,6 +443,7 @@ UPDATE server SET
 	tcp_port=:tcp_port,
 	type=:server_type_id,
 	upd_pending=:upd_pending,
+	xmpp_id=:xmpp_id,

Review comment:
       I agree, that was the reason (immutability) I had removed it in #4881




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



[GitHub] [trafficcontrol] mitchell852 commented on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816929631


   > > there is some incorrect documentation regarding XMPPID. want to fix that too? lots of this:
   > > ```
   > > xmppId
   > > An identifier to be used in XMPP communications with the server - in nearly all cases this will be the same as hostName
   > > ```
   > 
   > Isn't that part of v1 docs.. soon to go away? I checked the codebase and couldn't find the above mention in any other documentation.
   
   you are right @rimashah25 and it looks like it's better defined elsewhere:
   
   ```
   xmppId
   A system-generated UUID used to generate a server hashId for use in Traffic Router’s consistent hashing algorithm. This value is set when a server is created and cannot be changed afterwards.
   ```


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



[GitHub] [trafficcontrol] rimashah25 commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rimashah25 commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610850861



##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -443,6 +443,7 @@ UPDATE server SET
 	tcp_port=:tcp_port,
 	type=:server_type_id,
 	upd_pending=:upd_pending,
+	xmpp_id=:xmpp_id,

Review comment:
       I agree, that was the reason I had removed it in #4881




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



[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610884879



##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -443,6 +443,7 @@ UPDATE server SET
 	tcp_port=:tcp_port,
 	type=:server_type_id,
 	upd_pending=:upd_pending,
+	xmpp_id=:xmpp_id,

Review comment:
       Removed `xmpp_id` from the update query in 68c51e362d.




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



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610723419



##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -1638,7 +1640,11 @@ func Update(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	if server.XMPPID != nil && *server.XMPPID != originalXMPPID {
+	if server.XMPPID == nil || *server.XMPPID == "" {
+		log.Infof("Found empty XMPPID for server %s, setting random XMPPID", *server.HostName)
+		server.XMPPID = newUUID()

Review comment:
       We can't really do this either -- we'd have to set it to the hostname instead. Or rather, we shouldn't set it at all in an update, but just assume that nil/empty means hostname.




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



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610786129



##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -443,6 +443,7 @@ UPDATE server SET
 	tcp_port=:tcp_port,
 	type=:server_type_id,
 	upd_pending=:upd_pending,
+	xmpp_id=:xmpp_id,

Review comment:
       we should remove this line to ensure that it's impossible to update (assuming any future bugs in validation logic)

##########
File path: traffic_ops/traffic_ops_golang/server/servers.go
##########
@@ -1459,10 +1460,8 @@ func Update(w http.ResponseWriter, r *http.Request) {
 	}
 
 	original := originals[0]
-	if original.XMPPID == nil {
-		sysErr = errors.New("original server had no XMPPID")
-		api.HandleErr(w, r, tx, http.StatusInternalServerError, nil, sysErr)
-		return
+	if original.XMPPID == nil || *original.XMPPID == "" {
+		log.Warnln("original server had no XMPPID")

Review comment:
       we should include more context, including the server hostname, in this log message




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



[GitHub] [trafficcontrol] mitchell852 commented on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816817394


   there was some incorrect documentation regarding XMPPID. want to fix that too? lots of this:
   
   ```
   xmppId
   An identifier to be used in XMPP communications with the server - in nearly all cases this will be the same as hostName
   ```


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



[GitHub] [trafficcontrol] rawlinp commented on a change in pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rawlinp commented on a change in pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#discussion_r610193246



##########
File path: traffic_ops/app/db/migrations/2021040819481469_generate_uuid_for_xmpp_id_where_empty.sql
##########
@@ -0,0 +1,23 @@
+/*
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+*/
+
+-- +goose Up
+-- SQL in section 'Up' is executed when this migration is applied
+CREATE EXTENSION pgcrypto; /* Loads pgcrypto if gen_random_uuid() does not already exist */
+UPDATE "server" s set xmpp_id = gen_random_uuid() WHERE s.xmpp_id IS NULL OR s.xmpp_id = '';

Review comment:
       We can't update existing xmpp_ids to UUIDs because they're currently getting defaulted to their hostnames. So the migration would have to update null xmpp_ids to the server's host_name; otherwise, TR will consistent-hash the server differently, potentially cold-caching all of them.




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



[GitHub] [trafficcontrol] rawlinp merged pull request #5725: Set server XMPPID to hostname if empty

Posted by GitBox <gi...@apache.org>.
rawlinp merged pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725


   


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



[GitHub] [trafficcontrol] zrhoffman commented on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
zrhoffman commented on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816954249


   > > > there is some incorrect documentation regarding XMPPID. want to fix that too? lots of this:
   > > > ```
   > > > xmppId
   > > > An identifier to be used in XMPP communications with the server - in nearly all cases this will be the same as hostName
   > > > ```
   > > 
   > > 
   > > Isn't that part of v1 docs.. soon to go away? I checked the codebase and couldn't find the above mention in any other documentation.
   > 
   > you are right @rimashah25 and it looks like it's better defined elsewhere:
   > 
   > ```
   > xmppId
   > A system-generated UUID used to generate a server hashId for use in Traffic Router’s consistent hashing algorithm. This value is set when a server is created and cannot be changed afterwards.
   > ```
   
   Using the newer XMPPID definition for API v1 in a20cdf0def.


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



[GitHub] [trafficcontrol] rimashah25 edited a comment on pull request #5725: Generate XMPPID on server update if it is empty

Posted by GitBox <gi...@apache.org>.
rimashah25 edited a comment on pull request #5725:
URL: https://github.com/apache/trafficcontrol/pull/5725#issuecomment-816898945


   > there is some incorrect documentation regarding XMPPID. want to fix that too? lots of this:
   > 
   > ```
   > xmppId
   > An identifier to be used in XMPP communications with the server - in nearly all cases this will be the same as hostName
   > ```
   
   Isn't that part of v1 docs.. soon to go away? I checked the codebase and couldn't find the above mention in any other documentation.


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