I have my blog in Drupal 5.14 that i just installed in a new 5.14 platform (from our old 0.1-dev hostmaster setup to our new 0.2-alpha install, using a crude manual backup/restore hack, which I'll explain later). I deployed a new 5.16 platform and verified it properly, and made sure all modules were present. Then I tried to migrate from 5.14 to 5.16. There was a critical error in the migration script:

Task starts processing
Running: php /var/aegir/drush/drush.php --root='/var/aegir/drupal-5.14' 'provision' 'migrate' 'anarcat.koumbit.org' '/var/aegir/drupal-5.16' --backend
Drush bootstrap phase : _drush_bootstrap_drush()
Drush bootstrap phase : _drush_bootstrap_drupal_root()
Loading drushrc "/srv/aegir/drupal-5.14/drushrc.php" into "drupal" scope.
Initialized Drupal 5.14 root directory at /var/aegir/drupal-5.14
Found command: provision migrate
Initializing drush commandfile: provision_apache
Initializing drush commandfile: provision_drupal
Initializing drush commandfile: provision_mysql
Including /var/aegir/.drush/provision/platform/migrate.provision.inc
Drush bootstrap phase : _drush_bootstrap_drupal_site()
Initialized Drupal site anarcat.koumbit.org at sites/anarcat.koumbit.org
Loading drushrc "/srv/aegir/drupal-5.14/sites/anarcat.koumbit.org/drushrc.php" into "site" scope.
Including /var/aegir/.drush/provision/platform/backup.provision.inc
Including /var/aegir/.drush/provision/db_server/backup.provision.inc
Generating mysql dump for anarcat.koumbit.org.
mysqldump -usite_137_0 -pXXXXXXXXX site_137_0 > sites/anarcat.koumbit.org/database.sql
Adding sites directory to /var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar
cd /var/aegir/drupal-5.14/sites/anarcat.koumbit.org; tar -rf /var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar *
gzip /var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar
Deleted mysql dump from sites directory
Running: php /var/aegir/drush/drush.php --root='/var/aegir/drupal-5.16' --uri='http://anarcat.koumbit.org' 'provision' 'deploy' 'anarcat.koumbit.org' '/var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar.gz' --backend
Drush bootstrap phase : _drush_bootstrap_drush()
Drush bootstrap phase : _drush_bootstrap_drupal_root()
Loading drushrc "/srv/aegir/drupal-5.16/drushrc.php" into "drupal" scope.
Initialized Drupal 5.16 root directory at /var/aegir/drupal-5.16
Found command: provision deploy
Initializing drush commandfile: provision_apache
Initializing drush commandfile: provision_drupal
Initializing drush commandfile: provision_mysql
Including /var/aegir/.drush/provision/web_server/deploy.provision.inc
Including /var/aegir/.drush/provision/platform/deploy.provision.inc
Including /var/aegir/.drush/provision/db_server/deploy.provision.inc
Deploying site from /var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar.gz
tar -zxf /var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar.gz -C /var/aegir/drupal-5.16/sites/anarcat.koumbit.org
Running: tar -zxf /var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar.gz -C /var/aegir/drupal-5.16/sites/anarcat.koumbit.org
Successfully extracted the contents of /var/aegir/backups/anarcat.koumbit.org-2009-04-28_3.tar.gz
Drush bootstrap phase : _drush_bootstrap_drupal_site()
Initialized Drupal site anarcat.koumbit.org at sites/anarcat.koumbit.org
Loading drushrc "/srv/aegir/drupal-5.16/sites/anarcat.koumbit.org/drushrc.php" into "site" scope.
Created site_137 database
Found database dump at /var/aegir/drupal-5.16/sites/anarcat.koumbit.org/database.sql.
Database dump at /var/aegir/drupal-5.16/sites/anarcat.koumbit.org/database.sql is readable
Importing database using command: mysql -usite_137 -pXXXXXXX -hmysql.koumbit.net site_137 < /var/aegir/drupal-5.16/sites/anarcat.koumbit.org/database.sql
mysql -usite_137 -pXXXXXXX -hmysql.koumbit.net site_137 < /var/aegir/drupal-5.16/sites/anarcat.koumbit.org/database.sql
Database import failed
An error occurred at function : provision_mysql_provision_deploy
Dropping database site_137
Revoking privileges
Changes for provision_mysql_provision_deploy module have been rolled back.
Deleting sites/anarcat.koumbit.org/modules directory sucessful.
Deleting sites/anarcat.koumbit.org/files/tmp directory sucessful.
Deleting sites/anarcat.koumbit.org/files/pictures directory sucessful.
Deleting sites/anarcat.koumbit.org/files/images directory sucessful.
Deleting sites/anarcat.koumbit.org/files/geshifilter directory sucessful.
Deleting sites/anarcat.koumbit.org/files directory sucessful.
Deleting sites/anarcat.koumbit.org/themes directory sucessful.
Deleting sites/anarcat.koumbit.org directory sucessful.
Changes for provision_drupal_pre_provision_deploy module have been rolled back.
An error occurred at function : provision_drupal_provision_migrate
Removed unused migration site package
Changes for provision_drupal_pre_provision_migrate module have been rolled back.
Removing task from hosting queue
An error occurred at function : hosting_hosting_task
Changes for hosting_hosting_task module have been rolled back.

I am not sure as to why this is failing. One thing that is peculiar about the setup is that /var/aegir is a symlink to /srv/aegir. Another thing is that the modules are all in sites/all/modules in both platforms, but the migrate dialog seems to say that some modules are missing (even though the module list should be the same):

root@ceres:/var/aegir/drupal-5.16/sites/all/modules# ls |wc
     46      46     447
root@ceres:/var/aegir/drupal-5.16/sites/all/modules# cd /var/aegir/drupal-5.14/sites/all/modules/
root@ceres:/var/aegir/drupal-5.14/sites/all/modules# ls | wc
     46      46     447

Same with themes.

Finally the other peculiar thing about this site is that it was created using the following hack:

* on the old aegir platform, do a backup
* on the new platform, create the site (it will be empty, don't worry)
* on the new platform, do a backup
* transfer the backup from the old platform, copy over the backup in the new platform
* on the new platform, restore that backup

Everything came up normally. It works because the platform was identical (same modules, same database structure, etc).

Maybe that last assumption is false: maybe the database structure has one subtle difference that makes the database load crash...

Comments

anarcat’s picture

A quick note too:

sh-3.2$ php '/var/aegir/drush/drush.php' hosting task 193

Warning: array_keys(): The first argument should be an array in /srv/aegir/.drush/provision/platform/deploy.provision.inc on line 44

Warning: array_merge(): Argument #1 is not an array in /srv/aegir/.drush/provision/platform/deploy.provision.inc on line 49

Warning: array_merge(): Argument #2 is not an array in /srv/aegir/.drush/provision/platform/deploy.provision.inc on line 49

Warning: Invalid argument supplied for foreach() in /srv/aegir/.drush/provision/platform/deploy.provision.inc on line 50

That's what I get when retrying the task. Looks weird... especially since that doesn't come up in the task log.

anarcat’s picture

After thorough debugging, i ended up against the usual Drush wall. It seems that somehow the drush_shell_exec() function fails to call my mysql command properly.

I have tried the following patch on drush to see which commands were being executed exactly:

--- includes/drush.inc  19 Apr 2009 03:56:32 -0000      1.29
+++ includes/drush.inc  28 Apr 2009 22:48:33 -0000
@@ -385,6 +385,8 @@
   _drush_shell_exec_output_set($output);
 
   if (drush_get_context('DRUSH_VERBOSE')) {
+     system("echo '$cmd' >> /tmp/foobar");
+    drush_print("command output:\n", $indent);
     foreach ($output as $line) {
       drush_print($line, $indent + 2);
     }
cvs diff: Diffing services

Nasty, i know, but farily effective. My foobar file holds the following commands:

mysqldump -usite_137_0 -pXXXXX site_137_0 > sites/anarcat.koumbit.org/database.sql
cd /var/aegir/drupal-5.14/sites/anarcat.koumbit.org; tar -rf /var/aegir/backups/anarcat.koumbit.org-2009-04-28_4.tar * 
gzip /var/aegir/backups/anarcat.koumbit.org-2009-04-28_4.tar

Which basically means that the mysql load is simply not happening and is breaking before getting to that print...

Something weird is happening here.

anarcat’s picture

Title: cannot upgrade a working site from 5.14 to 5.16 » migrate broken with remote mysql servers
Status: Active » Needs work

I found the issue! The mysqldump doesn't use the -h flag.

That yield a very funny result: the content of the database dump is:

mysqldump: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect

... that's rather annoying. It's because of the way drush redirects stderr into stdout. That should be worked around, probably by telling mysqldump to directly write to the file without shell redirection.

anarcat’s picture

Status: Needs work » Fixed

So that was it. I committed a fix to take into account the db_host in mysqldumps. I hope that doesn't break localhost, but i don't think so since it's being used everywhere else.

I also committed a patch to use -r instead of stdout redirection to properly catch errors from mysqldump next time round.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

anarcat’s picture

Issue tags: +multiserver

tagging this old issue

  • Commit 9cb2816 on debian, dev-dns, dev-envobject, dev-koumbit, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, dev-newhooks, dev-nginx, dev-platform_management, dev-ports, dev-purgebackup, dev-restore, dev-services, dev-simplerinstaller, dev-site_rename, dev-ssl, dev_716166_apache_conf, dev_dns, dev_server_verify, prod-koumbit, ssl, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x authored by anarcat:
    pass along the db_host properly to mysqldump
    
    Closes: #447808
    
  • Commit cf65723 on debian, dev-dns, dev-envobject, dev-koumbit, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, dev-newhooks, dev-nginx, dev-platform_management, dev-ports, dev-purgebackup, dev-restore, dev-services, dev-simplerinstaller, dev-site_rename, dev-ssl, dev_716166_apache_conf, dev_dns, dev_server_verify, prod-koumbit, ssl, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x authored by anarcat:
    do not use shell redirection to write the SQL dump, use the -r flag...