diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-03-07 16:43:19 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-03-13 17:28:59 +0100 |
commit | 46555aed73791cba5eb1f1c6df1d00e2c02f3886 (patch) | |
tree | cf59677bfce13dc992ebe7488ecf96f511163e7b /src/buildtool/execution_api/local/garbage_collector.cpp | |
parent | 600876757ffe49248c34bab33d0d9247e60232f0 (diff) | |
download | justbuild-46555aed73791cba5eb1f1c6df1d00e2c02f3886.tar.gz |
GC: Fix uplinking of ActionResults in compatible
... as internally we do not do the Tree-dance. Instead, we
directly store the root Directory digest for ActionResult's
OutputDirectories.
Diffstat (limited to 'src/buildtool/execution_api/local/garbage_collector.cpp')
-rw-r--r-- | src/buildtool/execution_api/local/garbage_collector.cpp | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/src/buildtool/execution_api/local/garbage_collector.cpp b/src/buildtool/execution_api/local/garbage_collector.cpp index 31af07e5..a0b68811 100644 --- a/src/buildtool/execution_api/local/garbage_collector.cpp +++ b/src/buildtool/execution_api/local/garbage_collector.cpp @@ -234,59 +234,6 @@ auto GarbageCollector::UplinkTree(int index, std::string const& id) noexcept return true; } -auto GarbageCollector::UplinkBazelTree(int index, - std::string const& id) noexcept -> bool { - // Determine bazel tree path of given generation. - auto root = LocalExecutionConfig::CASDir<ObjectType::File>(index); - auto tree_path = GetStoragePath(root, id); - if (not FileSystemManager::IsFile(tree_path)) { - return false; - } - - // Determine bazel tree entries. - auto content = FileSystemManager::ReadFile(tree_path); - bazel_re::Tree tree{}; - if (not tree.ParseFromString(*content)) { - return false; - } - - // Uplink bazel tree entries. - auto dir = tree.root(); - for (auto const& file : dir.files()) { - if (not UplinkBlob(index, - NativeSupport::Unprefix(file.digest().hash()), - file.is_executable())) { - return false; - } - } - for (auto const& directory : dir.directories()) { - if (not UplinkBazelDirectory( - index, NativeSupport::Unprefix(directory.digest().hash()))) { - return false; - } - } - - // Determine bazel tree path in latest generation. - auto root_latest = LocalExecutionConfig::CASDir<ObjectType::File>(0); - auto tree_path_latest = GetStoragePath(root_latest, id); - - // Uplink bazel tree from older generation to the latest generation. - if (not FileSystemManager::IsFile(tree_path_latest)) { - if (not FileSystemManager::CreateDirectory( - tree_path_latest.parent_path())) { - return false; - } - if (not FileSystemManager::CreateFileHardlink( - tree_path, - tree_path_latest, - /*log_failure_at=*/LogLevel::Debug) and - not FileSystemManager::IsFile(tree_path_latest)) { - return false; - } - } - return true; -} - // NOLINTNEXTLINE(misc-no-recursion) auto GarbageCollector::UplinkBazelDirectory(int index, std::string const& id) noexcept @@ -414,7 +361,7 @@ auto GarbageCollector::UplinkActionCacheEntryBlob( } for (auto const& directory : result.output_directories()) { if (Compatibility::IsCompatible()) { - if (not UplinkBazelTree( + if (not UplinkBazelDirectory( index, NativeSupport::Unprefix(directory.tree_digest().hash()))) { return false; |