]> git.ipfire.org Git - thirdparty/ccache.git/commit
fix: Fix bookkeeping of raw files
authorJoel Rosdahl <joel@rosdahl.net>
Fri, 18 Aug 2023 20:17:40 +0000 (22:17 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 19 Aug 2023 18:28:32 +0000 (20:28 +0200)
commit69f2bcc5cfe836128224acd4c215e2831f757fdf
tree750d4dbae4346c3c9d884c51270fb06a569ea84b
parent4d13759bb9413e2ffab4c0c3e3694924d193be36
fix: Fix bookkeeping of raw files

Ccache 4.8-4.8.2 notes the size and count of raw files (written to the
cache if hard link or file clone mode is enabled) to a level 2 stats
file. However, the new cleanup algorithm (also introduced in 4.8)
assumes that all size/count statistics are placed in a level 1 stats
file. After a "ccache -c", the raw files will be "rediscovered" and
noted in level 1 stats files, thus duplicating bookkeeping in level 2
stats files, resulting in a too high cache size figure in "ccache -s".

To fix this, ccache will now:

- Note size/count of raw files in the proper level 1 stats file.
- When storing an entry on a cache miss, detect if the corresponding
  level 2 stats file has non-zero size/count statistics and propagate
  them to the level 1 stats file if so.
- Zero out files/count statistics for level 2 stats file on "ccache -c".

This means that the reported cache size will gradually correct itself
automatically. Alternatively, the user can run "ccache -c" to fix all
counters immediately.

Fixes #1320.
src/storage/local/LocalStorage.cpp
src/storage/local/LocalStorage.hpp