cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-9466) Upgrading to older CloudStack 4.0.x to 4.1.x causes sql contraint errors
Date Wed, 24 Aug 2016 07:34:21 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-9466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15434374#comment-15434374
] 

ASF subversion and git services commented on CLOUDSTACK-9466:
-------------------------------------------------------------

Commit 7530f4b6dd98c18bceda3e1bf7790c0689ff5441 in cloudstack's branch refs/heads/master from
[~rohit.yadav@shapeblue.com]
[ https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;h=7530f4b ]

CLOUDSTACK-9466: Fix fk constraint failure in upgrade path

In the 4.1.0-4.2.0 db upgrade path, it creates new tables to store secondary
(nfs) storage in image_store table and volumes in volume_store_ref table. In
the upgrade path, it first tries to migrate NFS storage pool where it excludes
storage pools which have been removed, but it migrates all the volumes without
checking if their storage pools have been removed. This causes fk constraint
failure as the volume/row being inserted refers to a storage pool which does
not exist in the image_store table.

The fix migrates all the nfs storage pools to image_store including removed
storage pools and in doing so migrates with the 'removed' field. This fixes
db upgrade for old pre-4.0 and 4.0/4.1 CloudStack clouds.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


> Upgrading to older CloudStack 4.0.x to 4.1.x causes sql contraint errors
> ------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9466
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9466
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>            Reporter: Rohit Yadav
>            Assignee: Rohit Yadav
>             Fix For: 4.10.0, 4.9.1
>
>
> In one of the upgrade tests, in one of the upgrade paths a key contraint error occurs
due to missing entry in the migration:
> 2016-08-22 14:42:09,060 DEBUG [c.c.u.d.Upgrade410to420] (main:null) (logid:) Migrating
NFS secondary storage to Image store
> 2016-08-22 14:42:09,080 DEBUG [c.c.u.d.Upgrade410to420] (main:null) (logid:) Marking
NFS secondary storage in host table as removed
> 2016-08-22 14:42:09,099 DEBUG [c.c.u.d.Upgrade410to420] (main:null) (logid:) Completed
migrating secondary storage to image store
> 2016-08-22 14:42:09,099 DEBUG [c.c.u.d.Upgrade410to420] (main:null) (logid:) Updating
volume_store_ref table from volume_host_ref table
> 2016-08-22 14:42:09,114 ERROR [c.c.u.d.Upgrade410to420] (main:null) (logid:) Unable to
migrate volume_host_ref.Cannot add or update a child row: a foreign key constraint fails (`cloud`.`volume_store_ref`,
CONSTRAINT `fk_volume_store_ref__store_id` FOREIGN KEY (`store_id`) REFERENCES `image_store`
(`id`) ON DELETE CASCADE)
> com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot add
or update a child row: a foreign key constraint fails (`cloud`.`volume_store_ref`, CONSTRAINT
`fk_volume_store_ref__store_id` FOREIGN KEY (`store_id`) REFERENCES `image_store` (`id`) ON
DELETE CASCADE)
> >---at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     
 
> >---at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> >---at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> >---at java.lang.reflect.Constructor.newInstance(Constructor.java:526)    
> On analysis it was found that nfs storage that were removed were not migrated causing
discrepancy in migrated data. Later when volumes/templates are migrated it causes sql constraint
issues as the nfs sec storage it refers does not exist.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message