From 62ceea46f33fe6a6704b40aaa2c980c8b29eff5e Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 19 Mar 2024 16:56:26 +0100 Subject: serve target: Fix sharding inconsistencies When running in single node, serve endpoint should not even consider sharding. Additionally, garbage collection uplinking should also take the shard into account. For this purpose, a TargetCache instance now remembers if it was explicitly sharded and passed that information to the GarbageCollector for uplinking. --- src/buildtool/storage/garbage_collector.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/buildtool/storage/garbage_collector.hpp') diff --git a/src/buildtool/storage/garbage_collector.hpp b/src/buildtool/storage/garbage_collector.hpp index c10eebc2..c4ceaf8a 100644 --- a/src/buildtool/storage/garbage_collector.hpp +++ b/src/buildtool/storage/garbage_collector.hpp @@ -60,9 +60,12 @@ class GarbageCollector { /// \brief Uplink entry from target cache across all generations to latest. /// Note that the entry will be uplinked including all referenced items. /// \param key Target cache key to uplink entry for. + /// \param shard Optional explicit shard, if the default is not intended. /// \returns true if cache entry was found and successfully uplinked. [[nodiscard]] auto static GlobalUplinkTargetCacheEntry( - TargetCacheKey const& key) noexcept -> bool; + TargetCacheKey const& key, + std::optional const& shard = std::nullopt) noexcept + -> bool; /// \brief Trigger garbage collection; unless no_rotation is given, this /// will include rotation of generations and deleting the oldest generation. -- cgit v1.2.3