Page MenuHomePhabricator

Select most recent donation country when adding country to silverpop_missing_countries
Open, MediumPublic

Description

Currently we are selecting MAX(country), I think we need to order by date.

Details

Event Timeline

Lars triaged this task as Medium priority.Nov 24 2025, 6:46 PM

Change #1236807 had a related patch set uploaded (by Ejegg; author: Ejegg):

[wikimedia/fundraising/tools@master] Get missing country from latest donation

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

Trying the timing of the query for the last couple weeks on staging, I get this for the old query: "59 rows in set (51.617 sec)", and this for the new one: "59 rows in set (1 min 5.344 sec)"

OK, the ungrouped 'INSERT / ON DUPLICATE KEY UPDATE no-op' seems to be a win - only 44 seconds for the select for the last two weeks on staging.

There was an even worse bug! The new test caught the fact that we weren't even consulting the country field that we've been backfilling from the contribution tracking. I've added a new COALESE() clause to get that in there.

That's fun. Confusing because we do coalesce when we insert into silverpop_export_staging, but I guess we need to do it again here with the dedupe factor.

Change #1236807 merged by jenkins-bot:

[wikimedia/fundraising/tools@master] Get missing country from latest donation

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