Page MenuHomePhabricator

Only run CargoStore validation logic before storing data
Closed, ResolvedPublic

Description

CargoStore includes validation logic that performs checks on incoming data, using the primary DB to fetch information like the table schema and existing values. However, this logic runs not just in contexts where data would be stored (e.g. on page saves), but any time the {{#cargo_store:}} PF or its Lua equivalents are invoked, including on page views with a parser cache miss. This is not optimal, as data wouldn't be stored in this situation anyways, and primary DB connections should be avoided on page views.

CargoStore should instead only perform this validation when the data would actually be stored.

Event Timeline

Change 1002942 had a related patch set uploaded (by TK-999; author: TK-999):

[mediawiki/extensions/Cargo@master] Only run CargoStore validation prior to attempting to store data

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

This makes sense - I don't think I thought about performance issues enough when first writing this code. Thank you!

Change 1002942 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] Only run CargoStore validation prior to attempting to store data

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

Yaron_Koren claimed this task.