{"data":{"id":"magento2-40643","source":"github-pr","sourceRef":"magento/magento2#40643","title":"setup:upgrade is changing indexer mode to `save` from `schedule` slowing it down immensely","pr":{"number":40643,"url":"https://github.com/magento/magento2/pull/40643","author":"Nuranto","mergedAt":"2026-06-16T10:43:53Z","mergeCommit":"8db17ee6ebd33b352177c13932197617b4080e28","headCommit":"2cdef1bda18221afb1a4556162ea37d4f6a1fd1b","baseRef":"2.4-develop","diffSha256":"fdefacae2840f60c02e0f8dc06024e15d334ca1640705ca2c6110978d5758bb0"},"issues":[{"number":33386,"url":"https://github.com/magento/magento2/issues/33386","title":"setup:upgrade is changing indexer mode to `save` from `schedule` slowing it down immensely","labels":["Area: Framework","Area: Performance","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x","Triage: Dev.Experience"],"kind":"human"}],"fixedIn":null,"containingTags":[],"reportedOn":null,"codeMatch":{"2.4.6":"conflict","2.4.6-p1":"conflict","2.4.6-p2":"conflict","2.4.6-p3":"conflict","2.4.6-p4":"conflict","2.4.6-p5":"conflict","2.4.6-p6":"conflict","2.4.6-p7":"conflict","2.4.6-p8":"conflict","2.4.6-p9":"conflict","2.4.6-p10":"conflict","2.4.6-p11":"conflict","2.4.6-p12":"conflict","2.4.6-p13":"conflict","2.4.6-p14":"conflict","2.4.6-p15":"conflict","2.4.7":"conflict","2.4.7-p1":"conflict","2.4.7-p2":"conflict","2.4.7-p3":"conflict","2.4.7-p4":"conflict","2.4.7-p5":"conflict","2.4.7-p6":"conflict","2.4.7-p7":"conflict","2.4.7-p8":"conflict","2.4.7-p9":"conflict","2.4.7-p10":"conflict","2.4.8":"clean","2.4.8-p1":"clean","2.4.8-p2":"clean","2.4.8-p3":"clean","2.4.8-p4":"clean","2.4.8-p5":"clean","2.4.9":"clean"},"affectedVersions":["2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"components":["magento/framework","magento/module-indexer"],"files":[{"path":"app/code/Magento/Indexer/Setup/Recurring.php","change":"modified","package":"magento/module-indexer"},{"path":"lib/internal/Magento/Framework/Mview/TriggerCleaner.php","change":"modified","package":"magento/framework"}],"stripped":{"tests":["lib/internal/Magento/Framework/Mview/Test/Unit/TriggerCleanerTest.php"],"docs":[],"outsideCode":[]},"linesChanged":82,"mergeBatched":false,"excluded":null,"sections":{"description":"1. setup:upgrade is always recreating the triggers causing huge downtime during the command execution\n2. sometimes the indexers never revert back to the scheduled mode and stay on save mode","stepsToReproduce":"1. A fairly large catalog with lots of categories (over 5000) and products (over 60k with over 200 attributes) \n2. The indexers set on schedule mode. \n3. Execute setup:upgrade","expectedResult":"1. I expect that setup:upgrade finishes fast and doesn't recreate the triggers if it's not needed. If the trigger exists, it shouldn't drop and recreate it. Only If it does not exist should it create it. \n2. It should never change the mode from schedule to save. The user has put it for a reason there","actualResult":"1. setup:upgrade is always recreating the triggers causing huge downtime during the command execution\n2. sometimes the indexers never revert back to the scheduled mode and stay on save mode\n\n\n### Additional Information\n- Confirmation note, AC, and suggested approach  https://github.com/magento/magento2/issues/33386#issuecomment-1043290448\n\n---\nPlease provide [Severity](https://devdocs.magento.com/guides/v2.4/contributor-guide/contributing.html#backlog) assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.\n\n- [X] Severity: **S0** _- Affects critical data or functionality and leaves users without workaround._\n- [ ] Severity: **S1** _- Affects critical data or functionality and forces users to employ a workaround._\n- [ ] Severity: **S2** _- Affects non-critical data or functionality and forces users to employ a workaround._\n- [ ] Severity: **S3** _- Affects non-critical data or functionality and does not force users to employ a workaround._\n- [ ] Severity: **S4** _- Affects aesthetics, professional look and feel, “quality” or “usability”._","source":"issue"},"signatures":[],"labels":{"area":["Framework","Performance"],"component":[],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Performance"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"a1301fd81a38bdd7e190d5ca620961d65e87be6270e930a6203bf9ece650a5b9","isBugfix":0.9603,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9223,"feature":0.0089,"refactor":0.0503,"tests_only":0.0104,"docs_only":0.0032,"dependency":0.0049},"confidence":0.824},"scope":{"score":1.1642,"probabilities":{"0":0.154,"1":0.5278,"2":0.3182},"confidence":0.1053},"risk":{"score":1.2175,"probabilities":{"0":0.2433,"1":0.2958,"2":0.4609},"confidence":0.0387},"area":{"choice":"framework","probabilities":{"catalog":0.0348,"checkout":0.0092,"customer":0.0071,"admin":0.0323,"graphql_api":0.0059,"framework":0.8614,"frontend":0.0087,"other":0.0406},"confidence":0.7099},"securityRelevant":0.0058,"reportedVersion":{"choice":"2.4.1","probabilities":{"2.4.0":0.0041,"2.4.0-p1":0.0048,"2.4.1":0.5954,"2.4.1-p1":0.0441,"2.4.2":0.0075,"2.4.2-p1":0.008,"2.4.2-p2":0.0089,"2.4.3":0.0047,"2.4.3-p1":0.0073,"2.4.3-p2":0.009,"2.4.3-p3":0.0053,"2.4.4":0.0048,"2.4.4-p1":0.0061,"2.4.4-p10":0.0043,"2.4.4-p11":0.006,"2.4.4-p12":0.0048,"2.4.4-p13":0.0045,"2.4.4-p14":0.0047,"2.4.4-p15":0.004,"2.4.4-p16":0.0042,"2.4.4-p17":0.0038,"2.4.4-p18":0.0034,"2.4.4-p2":0.0033,"2.4.4-p3":0.0032,"2.4.4-p4":0.0037,"2.4.4-p5":0.0036,"2.4.4-p6":0.0035,"2.4.4-p7":0.0031,"2.4.4-p8":0.003,"2.4.4-p9":0.0027,"2.4.5":0.0037,"2.4.5-p1":0.0043,"2.4.5-p10":0.0036,"2.4.5-p11":0.0052,"2.4.5-p12":0.0057,"2.4.5-p13":0.004,"2.4.5-p14":0.0041,"2.4.5-p15":0.0035,"2.4.5-p16":0.0033,"2.4.5-p17":0.004,"2.4.5-p2":0.0027,"2.4.5-p3":0.0028,"2.4.5-p4":0.0032,"2.4.5-p5":0.0031,"2.4.5-p6":0.0032,"2.4.5-p7":0.003,"2.4.5-p8":0.0028,"2.4.5-p9":0.0022,"2.4.6":0.0054,"2.4.6-p1":0.0059,"2.4.6-p10":0.0052,"2.4.6-p11":0.0051,"2.4.6-p12":0.005,"2.4.6-p13":0.0047,"2.4.6-p14":0.0043,"2.4.6-p15":0.0036,"2.4.6-p2":0.0033,"2.4.6-p3":0.0034,"2.4.6-p4":0.0043,"2.4.6-p5":0.0035,"2.4.6-p6":0.0037,"2.4.6-p7":0.0031,"2.4.6-p8":0.003,"2.4.6-p9":0.0023,"2.4.7":0.003,"2.4.7-p1":0.0038,"2.4.7-p10":0.0048,"2.4.7-p2":0.0034,"2.4.7-p3":0.0045,"2.4.7-p4":0.0048,"2.4.7-p5":0.0047,"2.4.7-p6":0.0056,"2.4.7-p7":0.0041,"2.4.7-p8":0.0038,"2.4.7-p9":0.0026,"2.4.8":0.0044,"2.4.8-p1":0.0046,"2.4.8-p2":0.0055,"2.4.8-p3":0.0051,"2.4.8-p4":0.0053,"2.4.8-p5":0.0052,"2.4.9":0.0054,"unspecified":0.0134},"confidence":0.3505},"backportWorthy":{"score":1.4137,"probabilities":{"0":0.1184,"1":0.3494,"2":0.5322},"confidence":0.129}},"curated":{"title":"Fixes setup:upgrade recreating every indexer trigger on each run","description":"During setup:upgrade, the Indexer Setup Recurring class unconditionally dropped and recreated the triggers of every scheduled indexer, acquiring exclusive table locks and causing downtime on large installations. Recurring now runs getChangelog()->create() and then TriggerCleaner::removeTriggers() once, which recreates a trigger only when its normalized statement differs from the database.","categories":["Performance"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.8-p5":{"before":"not-runnable","after":"error","adapted":false,"runAt":"2026-10-06T09:20:27.350Z","releaseCommit":"870a22c63d9d9b68fa3297962e2d5d5841115814","suites":{"unit":{"before":"not-runnable","after":"error","runAt":"2026-10-06T09:20:27.350Z"}}},"2.4.9":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:20:29.082Z","releaseCommit":"755e34dd689021c5165db9d35ecff74f7dc51527","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:29.082Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40643 details"}