HomePhabricator

Track collection item counts

Description

Track collection item counts

Add gather_list.gl_item_count field and make sure every time an
item is added/removed the list record is locked first (to create
a critical section) and the count is updated afterwards. Also
provides a maintenance script to batch correct the counts.

Watchlists are ignored and will always have a count of 0 (as it
would be a lot of work to track them and there is no strong use
case for it).

Bug: T97061
Change-Id: Id17619f959c51e0438b2dafcdeebf753df3da117