cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (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 Tue, 23 Aug 2016 10:34:20 GMT

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

ASF GitHub Bot commented on CLOUDSTACK-9466:
--------------------------------------------

GitHub user rhtyd reopened a pull request:

    https://github.com/apache/cloudstack/pull/1656

    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.
    
    /cc @jburwell @PaulAngus @karuturi @abhinandanprateek @murali-reddy 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shapeblue/cloudstack 4.9-fk410to420fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/1656.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1656
    
----
commit 1b678cbcaaff29024ffa93c10a36954eaa874f6a
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Date:   2016-08-23T07:53:18Z

    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