You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/11/23 10:26:26 UTC

[GitHub] [cloudstack] ustcweizhou opened a new pull request #4494: sql: Fix Zones are returned in a random order (#3934)

ustcweizhou opened a new pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494


   ### Description
   
   This PR updates sort_key to id if sort_key of all zones are 0 (including removed zones, which means sort_key is not set by customers), so zones will be ordered by id in listZones response.
   
   Fixes: #3934
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ********************************************************************************* -->
   <!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ********************************************************************************* -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [X] Minor
   - [ ] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   


----------------------------------------------------------------
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] [cloudstack] DaanHoogland commented on a change in pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on a change in pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#discussion_r528624072



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
##########
@@ -837,3 +837,6 @@ UPDATE `cloud`.`guest_os` SET category_id = 7 WHERE id = 275 AND display_name =
 -- Add flag 'hidden' in tables usage_ip_address and cloud_usage
 ALTER TABLE `cloud_usage`.`usage_ip_address` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
 ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
+
+-- Fix Zones are returned in a random order (#3934)
+UPDATE `cloud`.`data_center` JOIN (SELECT COUNT(1) AS count FROM `cloud`.`data_center` WHERE `sort_key` != 0) AS tbl_tmp SET `sort_key` = `id` WHERE count = 0;

Review comment:
       excuse my ignorance. why not just 
   ```
   UPDATE `cloud`.`data_center` SET `sort_key` = `id` WHERE `sort_key` = 0;
   ```
   this seems like it going to work as well, but i'm missing the point, i guess. at worst the first in the sortorder has to be put back at the fron, but this should be a onetime effort.




----------------------------------------------------------------
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] [cloudstack] DaanHoogland commented on a change in pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on a change in pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#discussion_r528683503



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
##########
@@ -837,3 +837,6 @@ UPDATE `cloud`.`guest_os` SET category_id = 7 WHERE id = 275 AND display_name =
 -- Add flag 'hidden' in tables usage_ip_address and cloud_usage
 ALTER TABLE `cloud_usage`.`usage_ip_address` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
 ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
+
+-- Fix Zones are returned in a random order (#3934)
+UPDATE `cloud`.`data_center` JOIN (SELECT COUNT(1) AS count FROM `cloud`.`data_center` WHERE `sort_key` != 0) AS tbl_tmp SET `sort_key` = `id` WHERE count = 0;

Review comment:
       so in the case above, `sort_key` is only changed if there is no `sort_key != 0`. This would mean that if there are three where it is 0 and one where it is 10, nothing gets changed, does it?
   
   if this is at all possible btw!




----------------------------------------------------------------
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] [cloudstack] DaanHoogland commented on a change in pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on a change in pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#discussion_r528752430



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
##########
@@ -837,3 +837,6 @@ UPDATE `cloud`.`guest_os` SET category_id = 7 WHERE id = 275 AND display_name =
 -- Add flag 'hidden' in tables usage_ip_address and cloud_usage
 ALTER TABLE `cloud_usage`.`usage_ip_address` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
 ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
+
+-- Fix Zones are returned in a random order (#3934)
+UPDATE `cloud`.`data_center` JOIN (SELECT COUNT(1) AS count FROM `cloud`.`data_center` WHERE `sort_key` != 0) AS tbl_tmp SET `sort_key` = `id` WHERE count = 0;

Review comment:
       ok, sounds reasonable.




----------------------------------------------------------------
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] [cloudstack] blueorangutan commented on pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#issuecomment-732104191


   Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2424


----------------------------------------------------------------
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] [cloudstack] rhtyd commented on pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#issuecomment-732839956


   @blueorangutan test


----------------------------------------------------------------
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] [cloudstack] blueorangutan commented on pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#issuecomment-733255582


   <b>Trillian test result (tid-3240)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 36586 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4494-t3240-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_privategw_acl.py
   Smoke tests completed. 86 look OK, 0 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


----------------------------------------------------------------
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] [cloudstack] blueorangutan commented on pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#issuecomment-732082410


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
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] [cloudstack] rhtyd commented on pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#issuecomment-732081886


   @blueorangutan package


----------------------------------------------------------------
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] [cloudstack] weizhouapache commented on a change in pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#discussion_r528719175



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
##########
@@ -837,3 +837,6 @@ UPDATE `cloud`.`guest_os` SET category_id = 7 WHERE id = 275 AND display_name =
 -- Add flag 'hidden' in tables usage_ip_address and cloud_usage
 ALTER TABLE `cloud_usage`.`usage_ip_address` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
 ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
+
+-- Fix Zones are returned in a random order (#3934)
+UPDATE `cloud`.`data_center` JOIN (SELECT COUNT(1) AS count FROM `cloud`.`data_center` WHERE `sort_key` != 0) AS tbl_tmp SET `sort_key` = `id` WHERE count = 0;

Review comment:
       @DaanHoogland exactly.
   IMHO, if there is a non-zero sort_key , which mean cloudstack user might use sort_key for ordering, we will not touch it.
   if all sort_key are 0, we change sort_key to id.




----------------------------------------------------------------
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] [cloudstack] rhtyd merged pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494


   


----------------------------------------------------------------
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] [cloudstack] weizhouapache commented on a change in pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#discussion_r528655634



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41400to41500.sql
##########
@@ -837,3 +837,6 @@ UPDATE `cloud`.`guest_os` SET category_id = 7 WHERE id = 275 AND display_name =
 -- Add flag 'hidden' in tables usage_ip_address and cloud_usage
 ALTER TABLE `cloud_usage`.`usage_ip_address` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
 ALTER TABLE `cloud_usage`.`cloud_usage` ADD COLUMN `is_hidden` smallint(1) NOT NULL DEFAULT '0' COMMENT 'is usage hidden';
+
+-- Fix Zones are returned in a random order (#3934)
+UPDATE `cloud`.`data_center` JOIN (SELECT COUNT(1) AS count FROM `cloud`.`data_center` WHERE `sort_key` != 0) AS tbl_tmp SET `sort_key` = `id` WHERE count = 0;

Review comment:
       @DaanHoogland assume the sort_key is 1,0, with your sql sort_key will be changed to 1,2.
   the order of zones is changed by the sql.
   
   




----------------------------------------------------------------
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] [cloudstack] blueorangutan commented on pull request #4494: sql: Fix Zones are returned in a random order (#3934)

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4494:
URL: https://github.com/apache/cloudstack/pull/4494#issuecomment-732841049


   @rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


----------------------------------------------------------------
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