summaryrefslogtreecommitdiff
path: root/src/buildtool/storage/garbage_collector.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-03-19 16:56:26 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-03-19 17:39:18 +0100
commit62ceea46f33fe6a6704b40aaa2c980c8b29eff5e (patch)
treefde64d5ff8f739b1dc7de8c48f45dadf1b869a87 /src/buildtool/storage/garbage_collector.cpp
parentc5344fadd9a032171eed799aa1d91dc9247c810f (diff)
downloadjustbuild-62ceea46f33fe6a6704b40aaa2c980c8b29eff5e.tar.gz
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.
Diffstat (limited to 'src/buildtool/storage/garbage_collector.cpp')
-rw-r--r--src/buildtool/storage/garbage_collector.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/buildtool/storage/garbage_collector.cpp b/src/buildtool/storage/garbage_collector.cpp
index 82dbc8d2..7ed8d572 100644
--- a/src/buildtool/storage/garbage_collector.cpp
+++ b/src/buildtool/storage/garbage_collector.cpp
@@ -97,12 +97,16 @@ auto GarbageCollector::GlobalUplinkActionCacheEntry(
}
auto GarbageCollector::GlobalUplinkTargetCacheEntry(
- TargetCacheKey const& key) noexcept -> bool {
+ TargetCacheKey const& key,
+ std::optional<std::string> const& shard) noexcept -> bool {
// Try to find target-cache entry in all generations.
- auto const& latest_tc = Storage::Generation(0).TargetCache();
+ auto const& latest_tc =
+ Storage::Generation(0).TargetCache().WithShard(shard);
for (std::size_t i = 0; i < StorageConfig::NumGenerations(); ++i) {
- if (Storage::Generation(i).TargetCache().LocalUplinkEntry(latest_tc,
- key)) {
+ if (Storage::Generation(i)
+ .TargetCache()
+ .WithShard(shard)
+ .LocalUplinkEntry(latest_tc, key)) {
return true;
}
}