-
-
Notifications
You must be signed in to change notification settings - Fork 446
Update getNextAutoincrement to not use showTableStatus #1721
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
Looks great, what is the oldest version of MySQL where this code will work? |
app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php
Outdated
Show resolved
Hide resolved
app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php
Outdated
Show resolved
Hide resolved
app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php
Outdated
Show resolved
Hide resolved
was this code tested on OM? |
I confirmed that the "SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES" query works on MySQL 5.6 and up and MariaDb 10.3 and up. (probably some earlier versions, these are just the oldest I checked) I've not tested an import in Magento, @jonashrem did you test an import with the latest version of this PR? |
app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php
Outdated
Show resolved
Hide resolved
I've rebased this and tested it briefly creating new customer/addresses/products, the autoincrements work fine. I've no idea if this is really a performance improvement or if it could create a problem. But now it's ready to be merged, or it should be closed. |
Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approve, but I didn't perform a end-to-end test.
@jonashrem Please confirm this has been tested in it's current state. Thanks!
sorry this got under. I did not test the current variant with up to date OpenMage. Do you have some specific test szenario in mind? |
I also will test this out as soon as possible |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested. It is faster by about 50% to sub mini-sec from 1.5ms.
Mage::getResourceHelper('importexport')->getNextAutoincrement('sales_flat_order_item');
Very odd, I don't see how that is possible.. Are you 100% certain the two tests were run against the same database? |
I encountered this issue the first time I tested this PR but forgot to post it. It seems |
@colinmollenhour I'm sure it is the same database @elidrissidev AFAIK |
Ahh, I still don't see how essentially the same query via the console and via PHP can have different results, but it appears the information schema data is indeed cached within MySQL for an entire 24 hours by default. This can be controlled by information_schema_stats_expiry. This can be set as a session variable just before the query and yield correct results which isn't a terrible approach, but not sure if that is really an improvement in performance at that point. Perhaps your IDE is setting this session variable behind the scenes and that is why the results are different? https://stackoverflow.com/a/65996809/187780 The |
It's probably just a feature of SequelAce so it makes sense now. :) |
I don't think stats cache expiry should be set globally if it is not absolutely necessary - that should be up to the DBA to decide ideally. It could be set just before querying information schema, perhaps using a static variable so that it is only done once. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to block the merge because of #1721 (comment)
what are we doing about this?
I think we should close it. |
me too, unless something completely different comes out, this is too risky |
Description (*)
update getNextAutoincrement to not use showTableStatus for performants reasons.
Related Pull Requests
magento/magento2#33433
#1712
Fixed Issues (if relevant)
/
Manual testing scenarios (*)
test import/export
Questions or comments
/
Contribution checklist (*)