-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add --no-db-upgrade option to setup:upgrade #35116
Conversation
Hi @AntonEvers. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review. For more details, 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, join the Community Contributions Triage session to discuss the appropriate ticket. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
…data install/update depending on setup:db:status Skip schema and data install/update with --no-update flag rename no-update to no-db-upgrade Resolve static test failure
3804fc9
to
504da9a
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Could the same end result be achieved like so
? Without the need for an extra flag? I believe that is what Deployer Plus has been doing for a few years now. |
Hi @fooman, It is different from what you describe. if (!setup:db:status) {
setup:upgrade
} else {
app:config:import
} We will call that "deployer-plus". Take a look at
Especially updateModulesSequence is important here, I think you can live without validateSearchEngine and removeUnusedTriggers.
|
Updating the module sequence is a development task, not something that should be done during deployment. The deployment process should compile and deploy a known-state, not make configuration changes (ie, write to Deployer-plus actually doesn't run Perhaps the change that's needed here is to convert ece-tools to use https://github.com/magento/ece-tools/blob/b4ea5e111aeadb6d1d06e4a9983288eb73bd91ca/scenario/deploy.xml#L105 Do you have any information about what tasks are taking a long time when you run |
@AntonEvers thanks for getting back to me. I believe a committed app/etc/config.php should help with the module order. If you run However maybe this points to a need for a separate command to check module sequence? |
@fooman absolutely, a committed config.php with the right sequence will also remove the need for running updateModulesSequence. My experience is that we cannot consistently rely on a manually updated config.php file, so an automated check will be useful. I am thinking about including the sequence check in the |
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.
@AntonEvers Based on discussions on the internal ticket MCLOUD-8511 and that skipping setup:upgrade could cause other issues (such as not running recurring scripts) and that the solution would actually slow down deployments, can this PR be closed?
This already exists, by the command |
@hostep, @fooman and @BarnyShergold with the current code base I would say that it is not beneficial indeed to skip
This might be valuable info for the maintainers of Deployer Plus as well. My personal view is that the steps that cannot be skipped should become part of For now I will look into my clients custom recurring scripts and recurring data scripts, maybe even add some logging so that I can see which script takes so long during the deployment. Because as far as I can see deployment should not take long at all if the above scripts are executed, and no sample data is installed. Customer grid reindex is the most probable suspect for customers without recurring scripts of their own I think. Personally I would patch this so that it is not executed during deployment. |
Description (*)
Maintenance mode during deployment on cloud, as well as on-premise, can be significantly shortened, by skipping schema and data install/update steps.
"Zero-Downtime Deployment" can still requires up to 5 minutes of downtime with big databases. With databases of 100+ GiB, the recurring operations in setup:upgrade can take 5 minutes, even if there is no module to update. This leads to timeouts on the frontend system, which is waiting for Adobe Commerce to respond, often no longer than 30 seconds before timing out (if the customer has not left by then).
Reducing the maintenance mode from 5 minutes to 15 seconds, can be achieved by skipping lengthy database operations, if all modules are up-to-date. But we cannot simply skip
setup:upgrade
entirely whensetup:db:status
tells us that modules are up to date. Thesetup:upgrade
command contains more than just upgrade code, that can not be found in any other command. For instance the\Magento\Setup\Model\Installer::updateModulesSequence
method and\Magento\Setup\Model\Installer::removeUnusedTriggers
, but also\Magento\Setup\Model\SearchConfig::validateSearchEngine
which is only found on the search config save action but not in any other deployment command.Because of this, I would like to add the option to skip schema and data upgrades when executing
setup:upgrade
. Deployments should executesetup:db:status
before going into maintenance mode and use the outcome of that command to determine whether to skip the schema and data upgrades.An alternative was to include the
setup:db:status
withinsetup:upgrade
and let it decide for itself whether to run DB upgrades or not, which I have created a PR for in ed11437, but this results in executingsetup:db:status
inside maintenance mode, adding 10 seconds to maintenance mode, for a command that does not need maintenance mode to be enabled.Below diagram shows the current deployment, with maintenance mode enabled, and
setup:upgrade
taking 5 minutes of that time.The second diagram shows what it could look like, when skipping
$installer->installSchema($request)
and$installer->installDataFixtures($request, true)
in thesetup:upgrade
command, based on the outcome ofsetup:db:status
.A 15 second delay in response time during deployment is completely acceptable. Whereas a 1 - 5 minute downtime is often not.
I have added the
--no-db-upgrade
flag to thesetup:upgrade
command in https://github.com/magento/magento2/pull/35116/filesECE tools should run
setup:db:status
before maintenance mode, to determine whether the--no-db-upgrade
flag should be set when using thesetup:upgrade
command. If all modules are up to date, the flag should be added to skip unnecessary code execution in maintenance mode. The request for this ECE tools update is logged in MDVA-43621.Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
bin/magento setup:upgrade --no-db-upgrade --keep-generated
should NOT RUN upgradesbin/magento setup:upgrade --keep-generated
should RUN upgradesQuestions or comments
Contribution checklist (*)