Skip to content

Make sure temporary tables always get cleaned up, even on faillure #27012

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

Merged
merged 2 commits into from
Apr 8, 2021

Conversation

quisse
Copy link

@quisse quisse commented Feb 25, 2020

Description (*)

Make sure temporary tables always get cleaned up, even on faillure.

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes M2 catalogrule_product__temp Tables #22273

Manual testing scenarios (*)

  1. ...
  2. ...

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 Feb 25, 2020

Hi @quisse. 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.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

Copy link
Contributor

@kandy kandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is a drawback to your fix.
After your changes, the index table will be cleaned up if any exception happens

Better to modify IndexerTableSwapper class to:

@hostep
Copy link
Contributor

hostep commented Apr 22, 2020

What's the status here? Just saw an error:

Table 'catalogrule_product__temp8f30230c' doesn't exist, query was: SHOW CREATE TABLE `catalogrule_product__temp8f30230c

happening on a shop during bin/magento setup:upgrade (shop was upgraded to Magento 2.3.5 yesterday).

Will this PR fix this problem?

Update: is probably something else, because on a second attempt to deploy to production, we now get:

Table 'catalogsearch_fulltext_scope4_tmp' doesn't exist, query was: SHOW CREATE TABLE `catalogsearch_fulltext_scope4_tmp`

Great, on to debugging 2.3.5 (again!)

Update 2: is probably a cron running during a deploy which causes it somehow, when we disable crons, then deploy and re-enable crons afterwards, it works.

Sorry for the noise in this PR, has probably nothing to do with it.

@quisse
Copy link
Author

quisse commented Jul 9, 2020

@kandy please, any response would be appreciated.

@santibm
Copy link

santibm commented Aug 5, 2020

hi, what's the status of this!? it's happening now on two customer sites heavily using catalog rules, @quisse does your fix work?!

@engcom-Charlie engcom-Charlie self-assigned this Aug 5, 2020
@engcom-Charlie
Copy link
Contributor

Hi @quisse, could you please look through failed tests?

@quisse
Copy link
Author

quisse commented Aug 5, 2020

@engcom-Charlie Please read previous comment.
#27012 (comment)

kandy
kandy previously approved these changes Aug 5, 2020
Copy link
Contributor

@engcom-Alfa engcom-Alfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @quisse .
Due to Magento Definition of Done all code must be covered by tests. Please cover your fix by automated test.
Thanks!

@ghost ghost dismissed kandy’s stale review August 6, 2020 07:49

Pull Request state was updated. Re-review required.

@ihor-sviziev
Copy link
Contributor

@magento run Performance Acceptance Tests

@ihor-sviziev
Copy link
Contributor

Seems like test failures not related to changes from this PR. Let’s wait a bit and restart tests again

@ihor-sviziev
Copy link
Contributor

@magento run Functional Tests B2B, Integration Tests

@ihor-sviziev
Copy link
Contributor

@magento run Functional Tests B2B

@quisse
Copy link
Author

quisse commented Oct 20, 2020

Feels like a lottery, isn't it? 🙈😅
Appreciate the effort by the way ☺️👌

@ihor-sviziev
Copy link
Contributor

There were some fixes in related repositories, so tests should be fixed already

@ihor-sviziev
Copy link
Contributor

@magento run Functional Tests B2B

1 similar comment
@quisse
Copy link
Author

quisse commented Oct 21, 2020

@magento run Functional Tests B2B

@ihor-sviziev
Copy link
Contributor

@quisse could you merge recent changes from 2.4-develop? Maybe that's causing test failures?

@ihor-sviziev
Copy link
Contributor

@magento run all tests

@ihor-sviziev ihor-sviziev added Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests and removed Auto-Tests: Covered All changes in Pull Request is covered by auto-tests labels Oct 22, 2020
@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-8367 has been created to process this Pull Request

@ihor-sviziev
Copy link
Contributor

@engcom-Alfa any updates on testing this PR?

@stefandoorn
Copy link
Contributor

This change will still leave temporary tables in case Magento hit a PHP memory limit, which is not that hard in Magento landscape. Maybe the indexer should start by cleaning up old tables, instead of doing it in the destructor.

@ihor-sviziev
Copy link
Contributor

@stefandoorn, that's actually another use case. From my perspective - this solution is good enough to be tested and merged. If you have a better solution - please send a Pull Request, we'll review it

@stefandoorn
Copy link
Contributor

Yeah, sorry, wasn't meant to discard this PR. It's indeed another use case to keep in mind :-)

@vzabaznov vzabaznov self-assigned this Apr 7, 2021
@magento-engcom-team magento-engcom-team merged commit e45e7e0 into magento:2.4-develop Apr 8, 2021
@m2-assistant
Copy link

m2-assistant bot commented Apr 8, 2021

Hi @quisse, 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.

@vzabaznov
Copy link
Contributor

Hey @quisse, the Performance team took care of your PR. Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Award: bug fix Component: CatalogRule Priority: P3 May be fixed according to the position in the backlog. Progress: ready for testing Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

M2 catalogrule_product__temp Tables