magento / magento/data-migration-tool
Migrating data from 1.9.3.7 to 2.3.3 duplicates every product
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 339
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
I'm migrating the data from 1.9.3.7 to 2.3.3. The migration is successful. But, when I run: `bin/magento index:reindex` I get the following error:
```
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Category Products index has been rebuilt successfully in 00:00:01
Product Categories index has been rebuilt successfully in 00:00:00
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Product EAV index has been rebuilt successfully in 00:00:01
Stock index has been rebuilt successfully in 00:00:00
Inventory index has been rebuilt successfully in 00:00:00
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:01
Google Product Removal Feed index has been rebuilt successfully in 00:00:00
Google Product Feed index has been rebuilt successfully in 00:00:00
Catalog Search indexer process unknown error:
Item (Magento\CatalogInventory\Model\Stock\Status) with the same ID "2" already exists.
```
If I check the database with the following query: `SELECT * FROM cataloginventory_stock_item WHERE item_id = 2; ` ... there is indeed 2 products with the same ID. Infact, there are duplicate products for every product in the database.
If I run the same query on the 1.9.3.7 database there is only 1 product. So, somewhere during the migration it's duplicated the products. Any idea what is happening here?
My config file for migration is below:
```
Migration\Step\Settings\Integrity
Migration\Step\Settings\Data
Migration\Step\Stores\Integrity
Migration\Step\Stores\Data
Migration\Step\Stores\Volume
Migration\Step\DataIntegrity\Integrity
Migration\Step\Eav\Integrity
Migration\Step\Eav\Data
Migration\Step\Eav\Volume
Migration\Step\Customer\Integrity
Migration\Step\Customer\Data
Migration\Step\Customer\Volume
Migration\Step\Map\Integrity
Migration\Step\Map\Data
Migration\Step\Map\Volume
Migration\Step\UrlRewrite\Version191to2000
Migration\Step\UrlRewrite\Version191to2000
Migration\Step\UrlRewrite\Version191to2000
Migration\Step\Log\Integrity
Migration\Step\Log\Data
Migration\Step\Log\Volume
Migration\Step\Ratings\Integrity
Migration\Step\Ratings\Data
Migration\Step\Ratings\Volume
Migration\Step\ConfigurablePrices\Integrity
Migration\Step\ConfigurablePrices\Data
Migration\Step\ConfigurablePrices\Volume
Migration\Step\OrderGrids\Integrity
Migration\Step\OrderGrids\Data
Migration\Step\OrderGrids\Volume
Migration\Step\TierPrice\Integrity
Migration\Step\TierPrice\Data
Migration\Step\TierPrice\Volume
Migration\Step\SalesIncrement\Integrity
Migration\Step\SalesIncrement\Data
Migration\Step\SalesIncrement\Volume
Migration\Step\Inventory\Integrity
Migration\Step\Inventory\Data
Migration\Step\Inventory\Volume
Migration\Step\PostProcessing\Data
Migration\Step\Customer\Delta
Migration\Step\Customer\Volume
Migration\Step\Map\Delta
Migration\Step\Map\Volume
Migration\Step\Log\Delta
Migration\Step\Log\Volume
Migration\Step\ConfigurablePrices\Delta
Migration\Step\ConfigurablePrices\Volume
Migration\Step\TierPrice\Delta
Migration\Step\TierPrice\Volume
Migration\Step\UrlRewrite\Version191to2000Delta
Migration\Step\UrlRewrite\Version191to2000
Migration\Step\OrderGrids\Delta
Migration\Step\OrderGrids\Volume
Migration\Step\SalesIncrement\Delta
Migration\Step\SalesIncrement\Volume
Migration\Step\Inventory\Delta
Migration\Step\Inventory\Volume
etc/opensource-to-opensource/1.9.3.7/map.xml.dist
etc/opensource-to-opensource/map-eav.xml.dist
etc/opensource-to-opensource/eav-document-groups.xml.dist
etc/opensource-to-opensource/eav-attribute-groups.xml.dist
etc/opensource-to-opensource/map-log.xml.dist
etc/opensource-to-opensource/log-document-groups.xml.dist
etc/opensource-to-opensource/settings.xml.dist
etc/opensource-to-opensource/map-customer.xml.dist
etc/opensource-to-opensource/customer-document-groups.xml.dist
etc/opensource-to-opensource/customer-attribute-groups.xml.dist
etc/opensource-to-opensource/deltalog.xml.dist
etc/opensource-to-opensource/order-grids-document-groups.xml.dist
etc/opensource-to-opensource/map-document-groups.xml.dist
etc/opensource-to-opensource/class-map.xml.dist
etc/opensource-to-opensource/1.9.3.7/map-tier-price.xml.dist
etc/opensource-to-opensource/map-stores.xml.dist
0
0
0
migration.log
%percent%% [%bar%] Remaining Time: %remaining%
1
opensource-to-opensource
1.9.3.7
SET NAMES utf8;
SET NAMES utf8;
${migration_crypt_key}
```
And I run like so: `sudo -H -u "${user}" bash -c "${webroot}/bin/magento migrate:data ${migration_dir}/config.xml"` ... which runs and completes successfully.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported `bin/magento migrate:data` command and the `Inventory Step` in the supplied migration config, then inspect the destination `cataloginventory_stock_item` rows and `migration.log`. Compare the source and destination records to identify where duplicates are introduced; done means the migration preserves one inventory row per product and `bin/magento index:reindex` completes without the duplicate-ID error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100