Magento Upgrade Takes Too Long and Never Completes

Magento upgrade takes too long and never completes

I On the query logging by changing the following lines in lib\Varien\Db\Adapter\Pdo\Mysql.php file

protected $_debug               = true;
protected $_logAllQueries = true;
protected $_debugFile = 'var/debug/pdo_mysql.log';

Then by analyzed the pdo_myql.log file I came to know that a query is executing with error and thus the magento installer run it again and again.

Error was.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ''11199-1' for key 'UNQ_INCREMENT_ID'

So I deleted the entry in the database table and in pdo_mysql.log now other queries are displaying and the up-gradation is complete.

Working many days on magento upgrade, I am summarizing the steps to successfully upgrading magento from 1.4.0.1 to 1.7.0.2. These errors displayed will be different for other projects because every project have different data.

  1. Create a fresh database for the new version. (I am using
    SQLyog because it is good for big database importing and exporting).

  2. Extract and Install fresh version 1.7.0.1 in www or htdocs.
    My project name is magento171.

  3. Create new database because we will need the fresh db in repair step.

  4. Import the old database data into the new database.

  5. Change the new database name in etc/local.xml in new installed version of magento.

  6. In etc/local.xml find and change SET NAMES utf8 to SET NAMES utf8; SET FOREIGN_KEY_CHECKS=0; SET UNIQUE_CHECKS=0; .

  7. Copy old project file in new version of magento. I have the theme in
    blank folder. Copy default if you have template files in default
    folder.

    • app\design\frontend\default\blank

    • app\code\local

    • skin\frontend\default/blank

    • app\etc\modules (copy the files which are not in the new version).

  8. On the MySql queries logging by changing the following lines in
    lib\Varien\Db\Adapter\Pdo\ Mysql.php

     protected $_debug               = true;
    protected $_logAllQueries = true;
    protected $_debugFile = 'var/debug/pdo_mysql.log';
  9. Search and change
    CREATE TABLE to CREATE TABLE IF NOT EXISTS In code/core/mage/.

  10. Change the following entries in the table core_config_data (use your
    project folder name).

      • web/unsecure/base_url | http://localhost/magento171/
    • web/secure/base_url | http://localhost/magento171/
  11. Rename /errors/local.xml.sample to /errors/local.xml to enable error_reporting .

  12. Clear the magento cache by delete all the data in var\cache.

  13. Go to browser and type the your project path.
    http://localhost/magento171/ and keep eyes on the browser and on the var/debug/pdo_mysql.log file.

  14. The first error occurred to me is: Error in file:
    "D:\xampp\htdocs\magento171\app\code\core\Mage\Sales\sql\sales_setup\mysql4-upgrade-1.3.99-1.4.0.0.php"

    • SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '7' for key 'PRIMARY'

    Fix: I found from pdo_mysql.log file that the issue is in the sales_flat_order table, which means many duplicate entries for primary key are there so I truncate all the sales tables. This is actually the error in my old DB. In new version increment_id is UNIQUE. We can't skip primary key checks, so I truncated all the tables related to sales. If you have same issue then truncate all tables related to that feature like if duplicate in customer then truncate all customer table or if in catalog then truncate catalog tables. But remember truncate should be done at the time when the error is occured because if truncated before the installation begins the installer will not read the existing data and finally you will miss some records like missing some orders or invoices.

    SET FOREIGN_KEY_CHECKS = 0;
    TRUNCATE `sales_flat_creditmemo`;
    TRUNCATE `sales_flat_creditmemo_comment`;
    TRUNCATE `sales_flat_creditmemo_grid`;
    TRUNCATE `sales_flat_creditmemo_item`;
    TRUNCATE `sales_flat_invoice`;
    TRUNCATE `sales_flat_invoice_comment`;
    TRUNCATE `sales_flat_invoice_grid`;
    TRUNCATE `sales_flat_invoice_item`;
    TRUNCATE `sales_flat_order`;
    TRUNCATE `sales_flat_order_address`;
    TRUNCATE `sales_flat_order_grid`;
    TRUNCATE `sales_flat_order_item`;
    TRUNCATE `sales_flat_order_payment`;
    TRUNCATE `sales_flat_order_status_history`;
    TRUNCATE `sales_flat_quote`;
    TRUNCATE `sales_flat_quote_address`;
    TRUNCATE `sales_flat_quote_address_item`;
    TRUNCATE `sales_flat_quote_item`;
    TRUNCATE `sales_flat_quote_item_option`;
    TRUNCATE `sales_flat_quote_payment`;
    TRUNCATE `sales_flat_quote_shipping_rate`;
    TRUNCATE `sales_flat_shipment`;
    TRUNCATE `sales_flat_shipment_comment`;
    TRUNCATE `sales_flat_shipment_grid`;
    TRUNCATE `sales_flat_shipment_item`;
    TRUNCATE `sales_flat_shipment_track`;
    SET FOREIGN_KEY_CHECKS = 1;
  15. The installation takes too long, so I inspect the pdo_mysql.log file and the following error is displaying again and again. Error displayed: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ''11199-1' for key 'UNQ_INCREMENT_ID''
    Fix:
    So I delete the first entry in the table.

  16. Database Rapair Step: It is necessary to Repair the new database with the fresh database using magento-db-repair-tool-1.1 (http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/db-repair-tool). It the end the report will show all the fixes.

  17. Now you can simply shift the website to the live server.

Extremely slow setup:upgrade on magento 2.4

Problem was solved by moving to a different database solution.
You may choose a more expensive general db type (we were testing basic), or host small VM with MariaDB.

What is the best way to upgrade Magento

There are two main approaches for upgrading Magento:

  1. Incremental upgrade
  2. Implement again Magento and import data from older version

Incremental upgrade

You can upgrade from 1.1 to 1.2, then to 1.3 and so on... One thing to keep in mind is that from Magento 1.1 alot of things changed.
Deactivate all your extensions installed on Magento 1.1 (most likely will not be compatibile with later versions).

This is a long process and requires lot of time and attention because all kinds of errors will be triggered (data inconsistency, table alters that will not work and so on).
Migration from Magento 1.4.1.x to Magento 1.6 and then to Magento Professional took us couple of weeks. In this case steps were: Magento 1.4.1 - 1.4.2 - 1.6.

Implement again Magento and import data from older version

You can do a fresh Magento 1.6 implementation, implement again the theme and import data (products, customers, orders - you will need an extension for this).

More info:
Upgrading Magento - Magento wiki

upgrade magento to latest version

The easiest way is to go to the Magento Connect Manager and press the Check for Upgrades Button.

Then you can see updates for all versions.

If you want to Update all packages then take Mage_All_Latest

I think when you are in the same Major release the update should work without any problems.

If you get some trouble with dependencies. You can do an upgrade with your console:

./mage upgrade-all --force

After using force you should check all your functions.



Related Topics



Leave a reply



Submit