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 2021/07/09 06:54:30 UTC

[GitHub] [cloudstack] cl-k-takahashi opened a new pull request #4034: Make DB upgrade queries idempotent for convenience

cl-k-takahashi opened a new pull request #4034:
URL: https://github.com/apache/cloudstack/pull/4034


   ## Description
   <!--- Describe your changes in detail -->
   Make DB upgrade queries idempotent for convenience
   <!-- 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: # -->
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ## 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. -->
   Manually deleted 4.13.1.0 row from version table and re-started CloudStack management server.
   
   <!-- 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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on a change in pull request #4034: Make DB upgrade queries idempotent for convenience

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



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41310to41400.sql
##########
@@ -49,9 +49,9 @@ CREATE TABLE IF NOT EXISTS `cloud`.`backup_offering` (
   CONSTRAINT `fk_backup_offering__zone_id` FOREIGN KEY (`zone_id`) REFERENCES `data_center` (`id`) ON DELETE CASCADE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `backup_offering_id` bigint unsigned DEFAULT NULL COMMENT 'ID of backup offering';
-ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `backup_external_id` varchar(255) DEFAULT NULL COMMENT 'ID of external backup job or container if any';
-ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `backup_volumes` text DEFAULT NULL COMMENT 'details of backedup volumes';
+CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_instance','backup_offering_id', 'bigint unsigned DEFAULT NULL COMMENT \'ID of backup offering\'');
+CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_instance','backup_external_id', 'varchar(255) DEFAULT NULL COMMENT \'ID of external backup job or container if any\'');
+CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.vm_instance','backup_volumes', 'text DEFAULT NULL COMMENT \'details of backedup volumes\'');

Review comment:
       Procedure `IDEMPOTENT_ADD_COLUMN` may not be declared in this sql 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] DaanHoogland commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   @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] blueorangutan commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   @DaanHoogland 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] blueorangutan commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   @DaanHoogland 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] sureshanaparti closed pull request #4034: Make DB upgrade queries idempotent for convenience

Posted by GitBox <gi...@apache.org>.
sureshanaparti closed pull request #4034:
URL: https://github.com/apache/cloudstack/pull/4034


   


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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   Packaging result: :heavy_check_mark: centos7 :heavy_check_mark: centos8 :heavy_check_mark: debian. SL-JID 290


-- 
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 pull request #4034: Make DB upgrade queries idempotent for convenience

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


   @GabrielBrascher are you satisfied with @rhtyd 's answer?


----------------------------------------------------------------
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 #4034: Make DB upgrade queries idempotent for convenience

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


   Packaging result: ✖centos7 ✖centos8 ✖debian. JID-2218


----------------------------------------------------------------
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 a change in pull request #4034: Make DB upgrade queries idempotent for convenience

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



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41310to41400-cleanup.sql
##########
@@ -25,4 +25,4 @@ DELETE FROM `cloud`.`configuration` WHERE name = 'host.maintenance.retries';
 UPDATE `cloud`.`storage_pool` SET path="/var/lib/libvirt/images" WHERE path="/var/lib/libvirt/images/";
 
 -- remove (one of) duplicate unique indexes from Region table
-ALTER TABLE `region` DROP INDEX `id_3`;
+ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;

Review comment:
       I ran this, it worked:
   ```
   > ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;
   Query OK, 0 rows affected, 1 warning (0.002 sec)
   Records: 0  Duplicates: 0  Warnings: 1
   
   ```




----------------------------------------------------------------
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] sureshanaparti commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   Hi @cl-k-takahashi Please check the comments above, and address the changes required (if any). Thanks.


-- 
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] GabrielBrascher commented on a change in pull request #4034: Make DB upgrade queries idempotent for convenience

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



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41310to41400-cleanup.sql
##########
@@ -25,4 +25,4 @@ DELETE FROM `cloud`.`configuration` WHERE name = 'host.maintenance.retries';
 UPDATE `cloud`.`storage_pool` SET path="/var/lib/libvirt/images" WHERE path="/var/lib/libvirt/images/";
 
 -- remove (one of) duplicate unique indexes from Region table
-ALTER TABLE `region` DROP INDEX `id_3`;
+ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;

Review comment:
       @rhtyd are yiou using mongoDB or mariaDB?
   
   I just execcuted it on a Mysql and it indeed fails:
   ```
   mysql> ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;
   ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS `id_3`' at line 1
   ```




----------------------------------------------------------------
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] GabrielBrascher commented on a change in pull request #4034: Make DB upgrade queries idempotent for convenience

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



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41310to41400-cleanup.sql
##########
@@ -25,4 +25,4 @@ DELETE FROM `cloud`.`configuration` WHERE name = 'host.maintenance.retries';
 UPDATE `cloud`.`storage_pool` SET path="/var/lib/libvirt/images" WHERE path="/var/lib/libvirt/images/";
 
 -- remove (one of) duplicate unique indexes from Region table
-ALTER TABLE `region` DROP INDEX `id_3`;
+ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;

Review comment:
       Mysql documentation (https://dev.mysql.com/doc/refman/5.7/en/drop-index.html):
   ```
   DROP INDEX [ONLINE | OFFLINE] index_name ON tbl_name
       [algorithm_option | lock_option] ...
   
   algorithm_option:
       ALGORITHM [=] {DEFAULT | INPLACE | COPY}
   
   lock_option:
       LOCK [=] {DEFAULT | NONE | SHARED | EXCLUSIVE}
   ```
   
   MariaDB:
   ```
   DROP INDEX [IF EXISTS] index_name ON tbl_name 
       [WAIT n |NOWAIT]
       [algorithm_option | lock_option] ...
   
   algorithm_option:
       ALGORITHM [=] {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT}
   
   lock_option:
       LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}
   ```




----------------------------------------------------------------
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] sureshanaparti closed pull request #4034: Make DB upgrade queries idempotent for convenience

Posted by GitBox <gi...@apache.org>.
sureshanaparti closed pull request #4034:
URL: https://github.com/apache/cloudstack/pull/4034


   


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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #4034: Make DB upgrade queries idempotent for convenience

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



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41310to41400-cleanup.sql
##########
@@ -25,4 +25,4 @@ DELETE FROM `cloud`.`configuration` WHERE name = 'host.maintenance.retries';
 UPDATE `cloud`.`storage_pool` SET path="/var/lib/libvirt/images" WHERE path="/var/lib/libvirt/images/";
 
 -- remove (one of) duplicate unique indexes from Region table
-ALTER TABLE `region` DROP INDEX `id_3`;
+ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;

Review comment:
       @rhtyd are yiou using mongoDB or mariaDB?
   
   I just execcuted it on a Mysql and it indeed fails:
   ```
   myysql> ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;
   ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS `id_3`' at line 1
   ```




----------------------------------------------------------------
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] nvazquez commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   Ping @cl-k-takahashi can you please check the open comments?


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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] sureshanaparti commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   ping @cl-k-takahashi , any update on outstanding comments?


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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


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


----------------------------------------------------------------
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 pull request #4034: Make DB upgrade queries idempotent for convenience

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


   @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] nvazquez commented on pull request #4034: Make DB upgrade queries idempotent for convenience

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


   Ping @cl-k-takahashi can you please check the open comments?


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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #4034: Make DB upgrade queries idempotent for convenience

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



##########
File path: engine/schema/src/main/resources/META-INF/db/schema-41310to41400-cleanup.sql
##########
@@ -25,4 +25,4 @@ DELETE FROM `cloud`.`configuration` WHERE name = 'host.maintenance.retries';
 UPDATE `cloud`.`storage_pool` SET path="/var/lib/libvirt/images" WHERE path="/var/lib/libvirt/images/";
 
 -- remove (one of) duplicate unique indexes from Region table
-ALTER TABLE `region` DROP INDEX `id_3`;
+ALTER TABLE `region` DROP INDEX IF EXISTS `id_3`;

Review comment:
       MySQL does not support `DROP INDEX IF EXISTS`, at least as far as I know there is no version supporting. If there is, can you please point it here?




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