[WIP] See how tests run without UPDATE IGNORE #17005
Closed
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.
Overview
Test removing the update ignore to see what fails.
I came across
DELETE FROM civicrm_contact WHERE primary_contact_id = 41372076
as a query involved in a deadlock during a batch merge and felt discomfort about whether this was always safe and also whether we could reduce locking queries in deduping (which this is)In the first instance I am looking to see if anything tested breaks if I switch back to a safer method
Before
When moving data the codes uses (for example)
UPDATE IGNORE civicrm_contact SET primary_contact_id = 41372076`; DELETE FROM civicrm_contact WHERE primary_contact_id = 41372076
After
UPDATE civicrm_contact SET primary_contact_id = 41372076`;
Technical Details
This code goes back to the start
civicrm/civicrm-svn@b74e4bb
Also from mysql manual :
"UPDATE IGNORE statements, including those having an ORDER BY clause, are flagged as unsafe for statement-based replication. (This is because the order in which the rows are updated determines which rows are ignored.) Such statements produce a warning in the error log when using statement-based mode and are written to the binary log using the row-based format when using MIXED mode. (Bug #11758262, Bug #50439) See Section 17.2.1.3, “Determination of Safe and Unsafe Statements in Binary Logging”, for more information."
ALSO
"UPDATE: With IGNORE, rows for which duplicate-key conflicts occur on a unique key value are not updated. Rows updated to values that would cause data conversion errors are updated to the closest valid values instead."
Comments