HomePhabricator

Lock less tables when finding background commands

Description

Lock less tables when finding background commands

make_plan_pending_background() is called every ten seconds by the
background runner, so it’s no surprise that its database query features
prominently in the list of slow queries. Previously, its FOR UPDATE
clause locked (rows in) seven tables each time it ran; now it only locks
three, the ones we actually need to find a command. If we found a
command to run in the background, then we do a separate query to get all
the data we need (actions etc.); this is one more query than before, but
since most of the time there won’t be a command to run, this should
still be an improvement overall.

Details

Provenance
LucasWerkmeisterAuthored on Aug 7 2021, 8:04 PM
Parents
R2494:bbdebedd0814: Add margin-bottom to <main>
Branches
Unknown
Tags
Unknown
ChangeId
None