-
Notifications
You must be signed in to change notification settings - Fork 9.4k
ISSUE-30304 - Mark index removal as non-destructive so indexes can be removed without being present in whitelist json #30939
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
base: 2.4-develop
Are you sure you want to change the base?
Conversation
… operations processing. Mark it as non-destructive so it's not dependent on whitelist json.
Hi @zaximus84. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket. 🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
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.
@zaximus84 changes look good to me! Could you please cover the solution with an automated test? Thanks!
/** | ||
* Operation name. | ||
*/ | ||
const OPERATION_NAME = 'drop_index'; |
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.
Please, make const private
@sidolov |
@zaximus84 you may check our testing documentation: https://devdocs.magento.com/guides/v2.4/test/testing.html |
…ility to drop index operation constant.
@sidolov Regarding the constant, it can't be private as it's referenced in DiffManager.php, but I explicitly marked it with public visibility. |
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.
@zaximus84 got it! Thanks for your contribution! We will proceed with the delivery of PR as soon as possible!
Hi @sidolov, thank you for the review.
|
@magento run all tests |
Note: Functional Tests B2B and Integration Tests are failed |
Hello, @zaximus84. Thanks for your contribution. Can you please fix the failed integartion test? |
I've spent quite a bit of time investigating the failing integration test, and I think I've hit a dead end determining how to resolve the issue. MODULE8_INSTALL_INDEX_TEMP is the first cause of failure, so I've been focusing on it. It's being added by the install script and removed by the upgrade script, so the final expected state in the schema xml for comparison is disabled="true". However, after the change in this PR, the automatic schema handling removes the index before the upgrade script for \Magento\Developer\Console\Command\SetupUpgradeTest. As a result, the dropIndex call in the upgrade script returns early and never registers the index removal, leaving the index in the final XML without being marked as disabled. I think someone with more expertise in integration tests will need to pick this up. |
@zaximus84 thanks for investigating. I think I could try to resolve this issue. |
@magento run all tests |
Hi @zaximus84, thanks for contributing! I believe we need to have some internal discussion on this issue, on my local tests the indexes were removed at the upgrade step of the integration tests, I believe this may be changing the behavior more than we would like. I will put this on hold and start a discussion internally, will add comments with updates as soon as we decide how to proceed with it. Thanks. |
@gabrieldagama, are there any updates after discussions? |
Hello, We have tried to reproduce the issue in the latest development branch i.e. 2.4-develop and it seems the issue is still relevant. We have followed the below steps in order to reproduce the issue:
Let me connect with its PO for further clarification on this. Thanks |
As bot moved it from On Hold to Ready for Testing, moving it back. Thank you! |
Description (*)
Previous state: When an index is present in the database but not in declarative schema, it's funneled into \Magento\Framework\Setup\Declaration\Schema\Operations\DropElement for evaluation. DropElement is considered destructive, so it fails \Magento\Framework\Setup\Declaration\Schema\Diff\Diff::canBeRegistered unless the index is present in a db_schema_whitelist.json file. An index must be present in the whitelist json to be automatically removed during declarative schema processing.
After this PR: The index removal is funneled into a new DropIndex class instead. This is considered non-destructive, so it passes \Magento\Framework\Setup\Declaration\Schema\Diff\Diff::canBeRegistered. Indexes present in the database but not declarative schema are automatically removed, regardless of what's in db_schema_whitelist.json.
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
I was uncertain if this needs tests written as there seem to be other schema operation classes that aren't tested. If it does need tests, I will need advice on what test class should be updated, and what the test should check for. I understand the concept of unit tests, but haven't written any before.
Contribution checklist (*)