Page MenuHomePhabricator

Decompose JOINs on address tables in EventStore
Closed, ResolvedPublic

Description

Events can potentially have multiple addresses (not exposed anywhere to the user, but supported in the backend). When looking up an event, we currently use JOINs to obtain all the data about an event and its addresses. However, this approach is cumbersome because this is a one-to-many relationships, and we'll add more similar relationships to this table in the near future (T334143). DBAs recommended using separate queries on each table instead (thus decomposing the JOINs), as it's actually better than the single-complex-query approach.

Acceptance criteria

  • (no need to QA) The code uses multiple queries to retrieve information about the events, instead of a single query with JOINs
  • Everything related to addresses (add, remove, view; both in the API and all relevant pages) still works correctly

Event Timeline

Change 906725 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Decompose JOINs on address tables in EventStore

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

Change 906725 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Decompose JOINs on address tables in EventStore

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

@Daimona I am getting the following error when posting an address that is too long for In person event or Online and in person event. :
Error 1406: Data too long for column 'cea_full_address' at row 1

In this case, it is the entire text of Mary Shelley's Frankenstein, but it should probably have a better error message than as seen below:

Screenshot 2023-05-12 at 2.01.39 PM.png (1×3 px, 1 MB)

You can test it with this event also, as I have added you as organizer. To reproduce, drop a really long string into the address to get the error message. Video below:

Screen Recording 2023-05-12 at 2.10.21 PM.gif (1×2 px, 1 MB)

This error also occurs on the Country field

Right, that's a pre-existing bug, see T325380. We should probably fix it at some point...

Ahhh, right. I remembered this incorrectly - I thought it was fixed before and then had the same bug, so thx for the reference here.

This is still working correctly in the GUI and API except for the pre-existing bug mentioned above (which presents in both the API and GUI) so I am moving this to done / resolved.