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

Make oldFields mapping hardcoded to speed up system #921

Merged
merged 1 commit into from
Jun 20, 2022

Conversation

tmotyl
Copy link
Contributor

@tmotyl tmotyl commented Apr 6, 2020

The mapping came with Magneto 1.6 to provide a backward compatibility
for old (pre 1.6) db field names.
Now the mapping is hardcoded in the class instead of saved
in the configuration.
This improves performance as Magento will not create tons of objects for
every new product/order/... entities.

Related: #920

@tmotyl tmotyl added the performance Performance related label Apr 6, 2020
colinmollenhour
colinmollenhour previously approved these changes Apr 6, 2020
@tmotyl
Copy link
Contributor Author

tmotyl commented Apr 6, 2020

@colinmollenhour can you take a look at the issue #920
I've described there 3 options how to solve it.
To be honest I would love to start removing deprecated stuff from pre 1.6 era

Copy link
Member

@Flyingmana Flyingmana left a comment

Choose a reason for hiding this comment

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

as mentioned in the related Issue, this is a serious BC break and should follow a certain process therefore.

@tmotyl
Copy link
Contributor Author

tmotyl commented Apr 7, 2020

I agree it's breaking (no configuration option any more) but I would not call it serious BC. I have not seen a project or module which would use this configuration options.
But anyway feel free to make RFC out of it, you will have my vote ;)
I will not have time in the next weeks to proceed with formal RFC. But I will continue to push any new fixed I will find of course.

@colinmollenhour colinmollenhour added the backwards compatibility Might affect backwards compatibility for some users label Apr 23, 2020
@tmotyl
Copy link
Contributor Author

tmotyl commented Apr 24, 2020

FYI, there are few places more with getOldFieldMap:
order address
order creditmemo
order invoice
quote
quote address
quote item

@sreichel
Copy link
Contributor

as mentioned in the related Issue, this is a serious BC break and should follow a certain process therefore.

If its about 11Y old extensions ... just drop it. (IMHO)

I guess with raising composer requirments to PHP7 we broke far more (users/agencies, that still rely on 5.x). If removal is a no-go I'd agree to hardcoded values ..

@github-actions github-actions bot added Component: Catalog Relates to Mage_Catalog Component: CatalogInventory Relates to Mage_CatalogInventory Component: Sales Relates to Mage_Sales Component: Weee Relates to Mage_Weee labels Jul 24, 2020
@tmotyl
Copy link
Contributor Author

tmotyl commented Dec 31, 2020

@Flyingmana Can we agree on following:
for branch 1.9 I will make the values hardcoded inside _initOldFieldsMap functions, and for 20.x I will remove the method ?

@tmotyl tmotyl changed the base branch from 1.9.4.x to 20.0.x-dev April 11, 2022 14:04
@github-actions github-actions bot added Component: lib/Varien Relates to lib/Varien Component: lib/* Relates to lib/* Component: Widget Relates to Mage_Widget labels Apr 20, 2022
@github-actions github-actions bot removed Component: lib/* Relates to lib/* Component: lib/Varien Relates to lib/Varien Component: Widget Relates to Mage_Widget labels Apr 20, 2022
@fballiano fballiano changed the base branch from 20.0.x-dev to 20.0 June 3, 2022 08:27
@fballiano fballiano dismissed colinmollenhour’s stale review June 3, 2022 08:27

The base branch was changed.

@tmotyl
Copy link
Contributor Author

tmotyl commented Jun 6, 2022

@Flyingmana @fballiano This patch is now less breaking:

  • no methods are removed
  • mapping which was present in magento is still working

However adding new through configuration will not work ($this->_oldFieldsMap = Mage::helper('sales')->getOldFieldMap).
This mechanism of fetching config on every object creation was the biggest performance bottleneck.

I'm ok with merging this patch to 1.9 branch as it's breaking potential is very limited, but If you prefer to have it only in v20, then lets' be it :)

@luigifab
Copy link
Collaborator

luigifab commented Jun 6, 2022

I vote for: drop them all, everywhere.

@fballiano
Copy link
Contributor

pre 1.6? let's kill them already!

colinmollenhour
colinmollenhour previously approved these changes Jun 9, 2022
@tmotyl
Copy link
Contributor Author

tmotyl commented Jun 9, 2022

@luigifab @fballiano you mean to merge it to 1.9 or to 20?

@fballiano
Copy link
Contributor

I think @luigifab and me wanted to say that if it's such an old functionality maybe we could remove it?

@tmotyl
Copy link
Contributor Author

tmotyl commented Jun 9, 2022

@fballiano We can remove it in separate patch targetted for 20.x only. Not to make unnecessary upgrade hassle for merchants on 1.9 (which we declare backward compatible).
Please lets agree on what to do with this patch in its current form -> merge to 1.9 or to 20.?

@tmotyl
Copy link
Contributor Author

tmotyl commented Jun 9, 2022

Basically this patch makes some default Magento reports usable again with more data, so I consider it a good tradeoff for 1.9

@fballiano
Copy link
Contributor

I don't know, since it was discussed to have it in v20 I've no idea what to do then :-D

@tmotyl
Copy link
Contributor Author

tmotyl commented Jun 9, 2022

Will I have your vote if we keep it for 20 only?
If yes then please vote and let's merge the thing :) lets not overthink it ;)
We can then promote v20 as much faster in some areas ;)

@fballiano
Copy link
Contributor

I trust that if you say it's a good thing it is for sure, although I keep thinking that we should remove the funcionality completely from v20, for sure there's no pre1.6 code out there anymore. and if there is... this is the last of their problems :-D

@ADDISON74
Copy link
Collaborator

As far as I understand it would not be wanted in OM-19 because it would create (possible) trouble with a source code before Magento version 1.6, especially extensions. That means a very long time ago. Who else uses extensions before M1-1.6 that weren't updated later? Hard to say.

I personally think that if the PR is a real improvement to go both versions and if it will create issues we will find out then. It can be quickly reverted for any version and is only a commit. I am also for OM-19 (even I don't use this version in production, OM-20 is concrete).

@colinmollenhour
Copy link
Member

I propose we leave it alone for v19 (the PR is already based on v20 so we're good) and add a note to the README.md section of change between v19 and v20 along the lines of:

Removed support for global/sales/old_fields_map defined in XML. #921

Then this can be merged and this PR will be listed in the release notes so users of v20 should do a quick check of their code for old_fields_map to see if they need to make any changes (highly unlikely afaik).

@ADDISON74
Copy link
Collaborator

I agree with the opinion expressed by @colinmollenhour.

@fballiano
Copy link
Contributor

@tmotyl I can't add the note to the README since you locked the PR from modifications :-)

@tmotyl
Copy link
Contributor Author

tmotyl commented Jun 15, 2022

@fballiano thats strange... consulting github documentation ... seems you can only enable "Allow edits from maintainers" on personal forks and not on organizational forks... see https://github.com/orgs/github-community/discussions/5634
So please let me know what you want to add or lets add the note in the followup PR

@fballiano
Copy link
Contributor

I just wanted to add this line:

Removed support for global/sales/old_fields_map defined in XML. #921

to the README in the "differences between v19 and v20" as suggested by Colin ;-)

The mapping came with Magneto 1.6 to provide a backward compatibility
for old (pre 1.6) db field names.
Now the mapping is hardcoded in the class instead of saved
in the configuration.
This improves performance as Magento will not create tons of objects for
every new product/order/... entities.

Related: OpenMage#920
@tmotyl
Copy link
Contributor Author

tmotyl commented Jun 20, 2022

here you go @fballiano

@tmotyl tmotyl dismissed Flyingmana’s stale review June 20, 2022 18:50

not so breaking any more

Copy link
Member

@elidrissidev elidrissidev left a comment

Choose a reason for hiding this comment

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

LGTM

@tmotyl tmotyl merged commit bafc48f into OpenMage:20.0 Jun 20, 2022
@github-actions
Copy link

Unit Test Results

1 files  1 suites   0s ⏱️
0 tests 0 ✔️ 0 💤 0 ❌
7 runs  7 ✔️ 0 💤 0 ❌

Results for commit bafc48f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards compatibility Might affect backwards compatibility for some users Component: Catalog Relates to Mage_Catalog Component: CatalogInventory Relates to Mage_CatalogInventory Component: Sales Relates to Mage_Sales Component: Weee Relates to Mage_Weee documentation needs investigation performance Performance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants