Page MenuHomePhabricator

Sandra can't dedupe Name + address matching contacts (no email match)
Closed, ResolvedPublic8 Estimated Story Points

Description

Sandra's goal is to be able to dedupe contacts first name + last name + street address match

Generally they start with a group & apply ^^ rule but it often spins off big queries - groups to merge....

Eileen merge -picks
DR Language queries
DR Recurring 7 days

  • also do (e.g) Country instead of group

Notes are from original description

Starting at ~2:28 UTC 2023-12-22 a user dedupe query ran long which eventually caused deadlocks and stopped user activity in civi

When the deadlocks were noticed with failmail, we would stop the offending queries using a combo of innotop to find the query and civicrm_query_killer to terminate the process. More documentation on that here: https://wikitech.wikimedia.org/wiki/Fundraising/Data_and_flow/Failmail_zoo#Fail_Mail_Storm_-_lots_of_different_jobs_failing_at_once

This happened again with two more users that were deduping, they were all running queries they had been running all week. Here is a snapshot of the graph showing the contention and innodb wait times. Direct link to the board.

frdb1005_contention_with_dedupe.png (954×527 px, 74 KB)

The queries would be logged to the mysql slow log after they completed or were terminated. They are found on frlog1002 at /var/log/remote/fundraisingdb-mysql-slow and the previous days compressed logs are in /srv/archive/frlog1002/logs.

With help from Eileen we narrowed the issue down to the specific dedupe rule Individual (General) Address and name (General). Using different rules works as normal.

The current working theory is that with the rule above and having to use such a large range of contacts to get results (100k, 150k) that its just working on data where there are lots of possible matches or getting stuck on some data that is not what we expected.

DR is pausing using the above rule and tested other rules, Sandra will msg us if she is looking at testing a new rule. There is more discussion in this thread: https://wikimedia.slack.com/archives/G015YLP3BLP/p1703266028217519

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Cstone updated the task description. (Show Details)

@SHust - can you and I have a check in about this so I can understand the workflows of the team a bit better on dedupes?

Hi @AKanji-WMF of course! Please send me an invite whenever is convenient for you.

Eileenmcnaughton renamed this task from User initiated deduping query never finishing and causing deadlocks to Sandra can't dedupe Name + address matching contacts (no email match).Feb 6 2024, 9:45 PM
Eileenmcnaughton updated the task description. (Show Details)

I have an update on this - & am working on a fix - the reason it changed is because it does the smaller tables first & at some point the address table began to have more rows that the contact table

Exciting news, thank you! Let me know when we can test it out :)

Are there any updates about the 'Address and name (General)' rule?

Flagging this as the priority phab for a dedupe sprint; workflow is broken.

AKanji-WMF raised the priority of this task from High to Unbreak Now!.Jul 17 2024, 6:21 PM
Dwisehaupt set the point value for this task to 8.Jul 29 2024, 8:22 PM

Change #1064130 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Add last_name,first_name index

https://gerrit.wikimedia.org/r/1064130

Change #1064130 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Add last_name,first_name index

https://gerrit.wikimedia.org/r/1064130

@SHust I added an index today that should give a further improvement on the speed on this query

Thank you so much, @Eileenmcnaughton! We're already seeing improvement in pulling data - 5K + from different states in the US alone 🙌
Could you clarify if the index you mentioned means we can try to pull more than 5K matches for a single query?

@SHust - yes - do some testing & see what works - maybe ping us if any get away on you so we can check for any run away queries

Change #1064513 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Regen triggers

https://gerrit.wikimedia.org/r/1064513

Change #1064513 merged by Dwisehaupt:

[wikimedia/fundraising/crm@master] Regen triggers

https://gerrit.wikimedia.org/r/1064513

Eileenmcnaughton moved this task from Doing to Done on the Fundraising Sprint: Sssss board.

Moved to done as this is working from Sandra's pov - it has been hanging around as there is an upstreaming task still to do - but I have opened a new phab for that

Change #1078487 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1078487

Change #1078487 merged by Eileen:

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1078487

Change #1080844 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1080844

Change #1080844 abandoned by Eileen:

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1080844

Change #1082315 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1082315

Change #1082315 merged by Ejegg:

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1082315

Change #1117275 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1117275

Change #1117275 merged by Eileen:

[wikimedia/fundraising/crm@master] Fix dedupe query speed - port https://github.com/civicrm/civicrm-core/pull/30591

https://gerrit.wikimedia.org/r/1117275