[Bugfix] - Double Calling Collect Totals Breaks MariaDB 11.8 on Magento 2.4.8-p5#154
Open
asim-blueprintprep wants to merge 1 commit into
Open
Conversation
…tals first. This is due to mariadb 11.8.x now having innodb snapshot on, which breaks checkout on double calling collect totals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
name: [Bugfix] - Double Calling Collect Totals Breaks MariaDB 11.8 on Magento 2.4.8-p5
Description
After upgrading to Magento 2.4.8-p5 and MariaDB 11.8.6 there is a new MariaDB feature
innodb_snapshot_isolation. This now throws an error on trying to run database queries on entries that no longer exist. After placing a successful test order with Affirm 4.0.9 - Any subsequent orders fail with error:This is referencing a shipping rate that has been previously deleted. Older versions of Mariadb silently fail, and handle this gracefully.
This comes from
AffirmCheckoutManager::initCheckout()calling collectTotals.CollectTotals triggers
$shippingAddress->collectShippingRates()which calls the delete.How To Reproduce
Steps to reproduce the behavior:
Expected behavior
Checkout should popup affirm modal and allow second order to be placed.
Screenshots
Error:

Red blocks to block out PII.
Benefits
It would allow a customer to place multiple orders in succession.
Additional information
This MR wraps collect totals in an if to check if it needs to call collect totals first. This is due to mariadb 11.8.x now having innodb snapshot on, which breaks checkout on double calling collect totals. The error comes from collectTotals triggering $shippingAddress->collectShippingRates() which has already been called. This didnt used to be a problem, and was gracefully handled, but new MariaDB versions now throw an error.