This is a followup to T201137: WikibaseLexeme 'jenkins_u0_mw.unittest_content_models' doesn't exist.
While running phpunit with temporary tables, the temporary tables will only exist on a single DB connection.
LoadBalancer::openLocalConnection can open extra connections if the auto commit flag is passed in and thus a connection category / connKey of "localAutoCommit" is used instead of "local".
In cases where this happens the new connection will not have access to the temporary tables created on the initial connection.
Hopefully now this issue is on phabricator if someone runs into it again they'll spot this and quickly figure out what is happening.
CCing @aaron as he probably has an idea of what is best.
Possible ways forward
- In unit tests when a local connection with autocommit is loaded, instead load the same connection that already exists?
- In unit tests when a local connection with autocommit is loaded, instead fail HARD, throw an exception that makes sense. (something like https://gerrit.wikimedia.org/r/#/c/mediawiki/core/+/450524/ perhaps)
- Stop using temporary tables in unit tests & CI in general? (Adding @hashar for this idea specifically)