Skip to content

#23429 wrap url rewrite regeneration into transaction to keep existing urls form deletion #23430

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

Conversation

ilnytskyi
Copy link
Contributor

@ilnytskyi ilnytskyi commented Jun 26, 2019

If an error occurred, deadlock, exception during URL Rewrite regeneration then old urls are lost and new ones not generated that leads to 404 error page on affected products.

Description (*)

Added transaction to rollback unsuccessful regeneration.

Fixed Issues (if relevant)

  1. Url Rewrites are lost if an exception thrown or deadlock during regeneration #23429: Url Rewrites are lost if an exception thrown or deadlock during regeneration

Manual testing scenarios (*)

  1. Emulate deadlock on url_rewrite table
  2. Regenerate URL rewrites

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jun 26, 2019

Hi @ilnytskyi. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@ilnytskyi ilnytskyi requested a review from kandy June 27, 2019 18:56
@ghost ghost assigned sidolov Jul 15, 2019
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5446 has been created to process this Pull Request
✳️ @sidolov, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Delta
Copy link
Contributor

Hi @ilnytskyi. I have difficulty with reproducing this issue on 2.3-develop.
Manual testing scenario:

  • Add exception before function $this->insertMultiple($data) in app/code/Magento/UrlRewrite/Model/Storage/DbStorage.php.
  • Edit product URL Key and save it

Result:
✔️ Exception is caught by EntitiyManager that does transaction rollback
✔️ URL leads to correct product page

@ilnytskyi
Copy link
Contributor Author

@engcom-Delta
My problem was that $this->deleteOldUrls($urls); removed old previous urls, and
$this->insertMultiple($data); did not not generate new if an exception thrown so I decided to wrap both into transaction. In case of anything, it would revert old urls.

@ghost
Copy link

ghost commented Jul 26, 2019

@ilnytskyi unfortunately, only members of the maintainers team are allowed to remove progress related labels to the pull request

@magento-engcom-team
Copy link
Contributor

Hi @VladimirZaets, thank you for the review.
ENGCOM-5446 has been created to process this Pull Request
✳️ @VladimirZaets, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Delta
Copy link
Contributor

✔️ QA passed

@m2-assistant
Copy link

m2-assistant bot commented Aug 16, 2019

Hi @ilnytskyi, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.4 milestone Aug 16, 2019
@VladimirZaets VladimirZaets added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants