delta migration problems

Hi,
I cloned our M1 database and migrated it to clean M2 successfully. We have made some modifications to M2 store and now tried delta migration. I cloned our M1 database again to new database. I changed dabase name at UB data migration admin panel. 
I tried from cli and run “php -f bin/ubdatamigration run --mode=update” All other steps went fine but step=5 (products) ended with no other error message but “fail” and step=7 ended with:
 “SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘213154’ for key ‘PRIMARY’. The SQL statement executed was: INSERT INTO `quote` (`store_id`, `is_active`, `is_virtual`, `is_multi_shipping`, `items_count`, `items_qty`, `orig_order_id`, `store_to_base_rate`, `store_to_quote_rate`, `grand_total`, `base_grand_total`, `customer_group_id`, `customer_note_notify`, `customer_is_guest`, `trigger_recollect`, `is_persistent`, `entity_id`, `created_at`, `updated_at`, `base_currency_code`, `store_currency_code`, `quote_currency_code`, `checkout_method`, `customer_id`, `customer_tax_class_id`, `customer_email`, `customer_firstname`, `customer_lastname`, `remote_ip`, `reserved_order_id`, `global_currency_code`, `base_to_global_rate`, `base_to_quote_rate`, `subtotal`, `base_subtotal`, `subtotal_with_discount`, `base_subtotal_with_discount`, `is_changed`) VALUES ”
I tried “delete From quote where entity_id = 213154;” and re-run “php -f bin/ubdatamigration run --step=7 --mode=update” and got 
Error: Call to a member function save() on null in /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php:2057
Stack trace:
#0 /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php(1604): Step7Controller->_migrateSalesQuoteAddress(Object(Mage2SalesOrder), ‘213154’, ‘213154’, Array, ‘1’, ‘1’)
#1 /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php(1457): Step7Controller->_migrateSalesQuote(Object(Mage2SalesOrder), Array, Array, Array, ‘1’, ‘1’, ‘1’)
#2 /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php(254): Step7Controller->_migrateSalesOrders(Array, Array, Array, Array, ‘1’)
#3 /home/XXX/public_html/magento2B/pub/ub-tool/protected/commands/RunCommand.php(74): Step7Controller->actionRun()
#4 /home/XXX/public_html/magento2B/pub/ub-tool/protected/commands/RunCommand.php(33): RunCommand->_migrateData(Object(Step7Controller))
#5 [internal function]: RunCommand->actionIndex(Object(Step7Controller), false, ‘update’, NULL)
#6 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/console/CConsoleCommand.php(172): ReflectionMethod->invokeArgs(Object(RunCommand), Array)
#7 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/console/CConsoleCommandRunner.php(71): CConsoleCommand->run(Array)
#8 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array)
#9 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/base/CApplication.php(185): CConsoleApplication->processRequest()
#10 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/yiic.php(33): CApplication->run()
#11 /home/XXX/public_html/magento2B/pub/ub-tool/protected/ubdatamigration_cli.php(5): require_once(‘/home/XXX/…’)
#12 /home/XXX/public_html/magento2B/bin/ubdatamigration(4): require_once(‘/home/XXX/…’)
XXX@c17602 [~/public_html/magento2B]#
So how to proceed? Thanks!

11 answers

Profile photo of Mall Staff 184060.00 $tone June 11, 2020
Public

Hi there,

step=5 (products) ended with no other error message but “fail”

Please try to run delta migration in step #5 again using the following CLI command:
php -f bin/ubdatamigration run --step=5 --mode=update;
And let me know how it goes then.

I tried “delete From quote where entity_id = 213154;” and re-run “php -f bin/ubdatamigration run --step=7 --mode=update” and got 
Error: Call to a member function save() on null in /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php:2057

After deleting the data records you mentioned, you need to refresh the cache of our module by running the following command:

rm -rf pub/ub-tool/protected/runtime/cache/

and then, you can continue with the delta migration in step #7.

Regards,
Mall.

#1
Profile photo of Mikko Kankaanpää 200.00 $tone June 11, 2020
Public

Hi,
Thanks for your help.
I did this and got this error:
Error: Call to a member function save() on null in /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php:2057
Stack trace:
#0 /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php(1604): Step7Controller->_migrateSalesQuoteAddress(Object(Mage2SalesOrder), ‘213154’, ‘213154’, Array, ‘1’, ‘1’)
#1 /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php(1457): Step7Controller->_migrateSalesQuote(Object(Mage2SalesOrder), Array, Array, Array, ‘1’, ‘1’, ‘1’)
#2 /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php(254): Step7Controller->_migrateSalesOrders(Array, Array, Array, Array, ‘1’)
#3 /home/XXX/public_html/magento2B/pub/ub-tool/protected/commands/RunCommand.php(74): Step7Controller->actionRun()
#4 /home/XXX/public_html/magento2B/pub/ub-tool/protected/commands/RunCommand.php(33): RunCommand->_migrateData(Object(Step7Controller))
#5 [internal function]: RunCommand->actionIndex(Object(Step7Controller), false, ‘update’, NULL)
#6 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/console/CConsoleCommand.php(172): ReflectionMethod->invokeArgs(Object(RunCommand), Array)
#7 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/console/CConsoleCommandRunner.php(71): CConsoleCommand->run(Array)
#8 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/console/CConsoleApplication.php(92): CConsoleCommandRunner->run(Array)
#9 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/base/CApplication.php(185): CConsoleApplication->processRequest()
#10 /home/XXX/public_html/magento2B/pub/ub-tool/yii-1.1.19/yiic.php(33): CApplication->run()
#11 /home/XXX/public_html/magento2B/pub/ub-tool/protected/ubdatamigration_cli.php(5): require_once(‘/home/XXX/…’)
#12 /home/XXX/public_html/magento2B/bin/ubdatamigration(4): require_once(‘/home/XXX/…’)
I emptied memcache, var/cache and pub/ub-tool/protected/runtime/cache/ 
and recloned our database and tried again and same errors. 
Any more ideas? I think this “delete From quote where entity_id = 213154;” was not correct since after that always get this new error. 
***
I think I found solution for step=5 problem. I had magento new inventory modules disabled, when I enabled those it gave no errors. 
Thanks!
 
 
 

#2
Profile photo of Mall Staff 184060.00 $tone June 11, 2020
Public

Hi there,

Error: Call to a member function save() on null in /home/XXX/public_html/magento2B/pub/ub-tool/protected/controllers/Step7Controller.php:2057
Stack trace:

Let’s try with steps as following:
+ Run following SQLs in your M2 database:

DELETE FROM ub_migrate_map_step_7 WHERE entity_name = 'salesrule' AND m2_id NOT IN (Select rule_id From salesrule);
DELETE FROM ub_migrate_map_step_7 WHERE entity_name = 'salesrule_coupon' AND m2_id NOT IN (Select coupon_id From salesrule_coupon);
DELETE FROM ub_migrate_map_step_7_order_item WHERE entity_name = 'sales_flat_order_item' AND m2_id NOT IN (Select item_id From sales_order_item);
DELETE FROM ub_migrate_map_step_7_order_address WHERE entity_name = 'sales_flat_order_address' AND m2_id NOT IN (Select entity_id From sales_order_address);
DELETE FROM ub_migrate_map_step_7_quote WHERE (entity_name = 'sales_flat_quote' OR entity_name = 'sales_flat_quote_active') AND m2_id NOT IN (Select entity_id From quote);
DELETE FROM ub_migrate_map_step_7_quote_item WHERE entity_name = 'sales_flat_quote_item' AND m2_id NOT IN (Select item_id From quote_item);
DELETE FROM ub_migrate_map_step_7_quote_address WHERE entity_name = 'sales_flat_quote_address' AND m2_id NOT IN (Select address_id From quote_address);

+ Once done, clean cache of our module by run command:
rm -rf pub/ub-tool/protected/runtime/cache/
And then, you continue with data migration in step #7.
Regards,
Mall.

#3
Profile photo of Mikko Kankaanpää 200.00 $tone June 11, 2020
Public

Hi,
 
Thanks. 
I did and there comes new and new “Duplicate entry” in “quote” with different entity ID. It goes forward with “delete From quote where entity_id = XXXX;” and the piece of SQL statement you gave. But this seems to take forever since there comes new and new similar errors.  Is there any way to find and delete all duplicate entries? Or other way to get this work?
Many thanks again for your help. 

#4
Profile photo of Mall Staff 184060.00 $tone June 12, 2020
Public

Hi there,

 Is there any way to find and delete all duplicate entries? Or other way to get this work?

Please try with these steps:

+ Run the following SQL queries in your M2 database:

Delete From salesrule Where rule_id NOT IN (Select m2_id From ub_migrate_map_step_7 where entity_name = 'salesrule');
Delete From quote Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_quote where entity_name = 'sales_flat_quote' OR entity_name = 'sales_flat_quote_active');
Delete From quote_item Where item_id NOT IN (Select m2_id From ub_migrate_map_step_7_quote_item where entity_name = 'sales_flat_quote_item');
Delete From quote_address Where address_id NOT IN (Select m2_id From ub_migrate_map_step_7_quote_address where entity_name = 'sales_flat_quote_address');
Delete From sales_order Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_order where entity_name = 'sales_flat_order');
Delete From sales_order_item Where item_id NOT IN (Select m2_id From ub_migrate_map_step_7_order_item where entity_name = 'sales_flat_order_item');
Delete From sales_order_address Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_order_address where entity_name = 'sales_flat_order_address');
Delete From sales_invoice Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_invoice where entity_name = 'sales_flat_invoice');
Delete From sales_invoice_item Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_invoice_item where entity_name = 'sales_flat_invoice_item');

+ Once done, you continue with the data migration in step #7.

Regards,
Mall.

#5
Profile photo of Mikko Kankaanpää 200.00 $tone June 12, 2020
Public

Hi,
I tried to run these queries but 

Delete From quote Where entity_id NOT IN (Select m2_id From ub_migrate_map_step_7_quote where entity_name = 'sales_flat_quote' OR entity_name = 'sales_flat_quote_active');"

Takes very long time or is stuck (do not know since it just says "running query". I have now waited for hour or so and it still keeps going.
#6
Profile photo of Mall Staff 184060.00 $tone June 14, 2020
Public

Hi there,

Takes very long time or is stuck (d

It seems that your database has a big volume on the quote data section. And that issue related to MySQL’s server issue at that time.
 
Please try to run all steps as suggested in my reply #5 again (You should run the SQL query one by one).

Regards,
Mall.

#7
Profile photo of Mikko Kankaanpää 200.00 $tone June 14, 2020
Public

I tried a couple of times but it did not work.
I migrated the database from the scratch again, this time I did not choose “keep original ID”. After all was finished and tested I DELTA migrated all steps and everything went fine. I tried with the “keep original ID” with couple different databases and it newer worked. 
I guess its fine to go on without original IDs at step #7.  Thanks for your help! 
 
 

#8
Profile photo of Mall Staff 184060.00 $tone June 15, 2020
Public

Hi there,

I migrated the database from the scratch again, this time I did not choose “keep original ID”. After all was finished and tested I DELTA migrated all steps and everything went fine

Yes, please continue with that.

I tried with the “keep original ID” with couple different databases and it newer worked. 
I guess its fine to go on without original IDs at step #7

To keep original IDs in step #7, your M2 have to be a fresh instance. And before performing the delta migration, you need to delete all testing/sample data added in M2 after the first migration (this is a required step). 

Regards,
Mall.

#9
Profile photo of Mikko Kankaanpää 200.00 $tone June 15, 2020
Public

Yes, I will. Just for your information, I tried to migrated M1 to fresh M2 without any data or modification or extensions. Then I tried to delta migrate right away and still got this duplicate error. Strange:) 
But I think this is now ok:) thansk! 

#10
Profile photo of ubdev Staff 98590.00 $tone June 15, 2020
Public

Hi there, 
Please move forward with the process at your end. In case you have any additional questions, feel free to get back to us here. 
Regards,
Ubertheme team

#11

Please login or Register to Submit Answer

Written By

Comments