Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect url rewrite record pagination #682

Closed
therool opened this issue Apr 18, 2019 · 3 comments
Closed

Incorrect url rewrite record pagination #682

therool opened this issue Apr 18, 2019 · 3 comments

Comments

@therool
Copy link
Contributor

therool commented Apr 18, 2019

Preconditions

  1. Magento 1.9.0.1 to Magento 2.3.1
  2. This seems to affect all versions of magento as the issue is with the Version191to2000.php, Version11300to2000.php, Version11410to2000.php

Steps to reproduce

  1. Have at least more than 50000 url rewrites
  2. Start the migration process
  3. Will receive [PDOException (23000)] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '50852' for key 'PRIMARY'

Expected result

  1. There should be no primary key constraint violations at url rewrite step as each record should be processed only once during url rewrite step

Actual result

  1. Will receive [PDOException (23000)] SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '50852' for key 'PRIMARY'
    image

Additional notes

The issue is caused that the $this->source->setLastLoadedRecord method is not being called and the data source pagination second page is not comply with the first result page query conditions.

Pagination queries:

  1. page 0
SELECT `core_url_rewrite`.* FROM `core_url_rewrite` WHERE (`url_rewrite_id` >= 0) ORDER BY `url_rewrite_id` ASC
  1. page 1 - Notice that the order condition is lost and the records do not comply with the query conditions above
SELECT `core_url_rewrite`.* FROM `core_url_rewrite` LIMIT 50000 OFFSET 50000

Exception trace:

In Mysql.php line 183:
                                                                                                   
  [PDOException (23000)]                                                                           
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '50852' for key 'PRIMARY'  
                                                                                                   

Exception trace:
 () at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/ResourceModel/Adapter/Mysql.php:183
 PDOStatement->execute() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/ResourceModel/Adapter/Mysql.php:183
 Migration\ResourceModel\Adapter\Mysql->insertMultiple() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/ResourceModel/Adapter/Mysql.php:140
 Migration\ResourceModel\Adapter\Mysql->insertRecords() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/ResourceModel/Destination.php:46
 Migration\ResourceModel\Destination->saveRecords() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/Step/UrlRewrite/Version191to2000.php:225
 Migration\Step\UrlRewrite\Version191to2000->data() at n/a:n/a
 call_user_func() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/Step/UrlRewrite/Version191to2000.php:242
 Migration\Step\UrlRewrite\Version191to2000->perform() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/Mode/AbstractMode.php:81
 Migration\Mode\AbstractMode->runStage() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/Mode/Data.php:124
 Migration\Mode\Data->runData() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/Mode/Data.php:69
 Migration\Mode\Data->run() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/data-migration-tool/src/Migration/Console/MigrateDataCommand.php:54
 Migration\Console\MigrateDataCommand->execute() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/symfony/console/Application.php:893
 Symfony\Component\Console\Application->doRunCommand() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/symfony/console/Application.php:262
 Symfony\Component\Console\Application->doRun() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/magento/framework/Console/Cli.php:102
 Magento\Framework\Console\Cli->doRun() at /var/www/monobunt/magento2/projects/ammerer/htdocs/vendor/symfony/console/Application.php:145
 Symfony\Component\Console\Application->run() at /var/www/monobunt/magento2/projects/ammerer/htdocs/bin/magento:23
@victor-v-rad
Copy link
Collaborator

victor-v-rad commented Apr 22, 2019

Hi @therool

Thank you for reporting this issue. Internal ticket MAGETWO-99323 to fix it

@therool
Copy link
Contributor Author

therool commented Apr 23, 2019

@victor-v-rad hello, I did create a pull request #683 which included the necessary fix but I see that you already pushed the fixes to the 2.3-develop branch so you can close the pull request #683

@victor-v-rad
Copy link
Collaborator

Oh, sorry! Pull requests from community are so rare and I did not notice it. I reverted my commit and merged your. Thank you @therool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants