Persist repo size cache updates
Ensure that updates to the repo_size cache are persisted instead of only
mutating the in-memory AtomicLong values.
The repo_size cache, introduced by Ia6be19c7f40, was updated only by
modifying the AtomicLong returned from the cache without writing the
value back via cache.put(). This meant that changes were applied solely
in memory and never propagated to the persistent cache layer. After a
Gerrit restart, all repo_size updates might have been lost.
Because the repo_size cache is configured with expireAfterWrite(1 day),
this bug only affected restarts that occurred before the TTL elapsed.
This led to incorrect quota enforcement. Once a repository reached its
maximum allowed size, pushes were correctly rejected. But after a
restart, the stale cached size from disk was used, causing Gerrit to
accept new pushes even though the quota had already been exceeded.
Update all call sites that modify the cached repository size to apply
the change and then persist it with cache.put(), keeping the in-memory
and on-disk cache layers consistent across restarts.
Bug: Issue 464448637
Change-Id: I2652482c3aa43dd34ec59cdb763ad8757b40d3ea
2 files changed