diff options
| author | Dan Engelbrecht <[email protected]> | 2026-02-06 12:43:15 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-02-06 12:43:15 +0100 |
| commit | f970ee291283a4f0ce8e2c0adfc77caefc30d829 (patch) | |
| tree | 9b0d796bcf8422c6cec53cde3ffa7d5c9c0ade99 | |
| parent | only check file size for requested range in asio TransmitFileAsync in debug m... (diff) | |
| download | zen-f970ee291283a4f0ce8e2c0adfc77caefc30d829.tar.xz zen-f970ee291283a4f0ce8e2c0adfc77caefc30d829.zip | |
fix target folder cleanup in builds download (#746)
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zenremotestore/builds/buildstorageoperations.cpp | 21 |
2 files changed, 10 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 46d40b6d5..41cc5349d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Improvement: Replaced http routing regex matching with faster matching lambdas for admin, buildstore, projectstore, objectstore and workspaces services - Bugfix: Restore `/health/log` and `/health/info` endpoint functionality - Bugfix: Fixed 32-bit truncation of transmission chunk sizes when using the asio http path +- Bugfix: `zen builds download` could leave files from previous downloads in the target folder ## 5.7.19 - Feature: `zen builds upload` now support structure manifest input for `--manifest-path` when the path has a `.json` extension enabling multi-part upload diff --git a/src/zenremotestore/builds/buildstorageoperations.cpp b/src/zenremotestore/builds/buildstorageoperations.cpp index 26968efc1..2319ad66d 100644 --- a/src/zenremotestore/builds/buildstorageoperations.cpp +++ b/src/zenremotestore/builds/buildstorageoperations.cpp @@ -1969,13 +1969,14 @@ BuildsOperationUpdateFolder::Execute(FolderContent& OutLocalFolderState) { if (!m_Options.WipeTargetFolder) { + // Check if it is already in the correct place if (auto RemotePathIt = RemotePathToRemoteIndex.find(LocalPath.generic_string()); RemotePathIt != RemotePathToRemoteIndex.end()) { const uint32_t RemotePathIndex = RemotePathIt->second; if (m_RemoteContent.RawHashes[RemotePathIndex] == RawHash) { - // It is already in it's desired place + // It is already in it's correct place RemotePathIndexToLocalPathIndex[RemotePathIndex] = LocalPathIndex; SequenceHashToLocalPathIndex.insert({RawHash, LocalPathIndex}); MatchCount++; @@ -1991,31 +1992,27 @@ BuildsOperationUpdateFolder::Execute(FolderContent& OutLocalFolderState) PathMismatchCount++; } } + + // Do we need it? if (m_RemoteLookup.RawHashToSequenceIndex.contains(RawHash)) { if (!CachedRemoteSequences.contains(RawHash)) { - ZEN_TRACE_CPU("MoveToCache"); - // We need it + // We need it, make sure we move it to the cache FilesToCache.push_back(LocalPathIndex); CachedRemoteSequences.insert(RawHash); + continue; } else { - // We already have it SkippedCount++; } } - else if (!m_Options.WipeTargetFolder) - { - // We don't need it - RemoveLocalPathIndexes.push_back(LocalPathIndex); - DeleteCount++; - } } - else if (!m_Options.WipeTargetFolder) + + if (!m_Options.WipeTargetFolder) { - // Delete local file as we did not scavenge the folder + // Explicitly delete the unneeded local file RemoveLocalPathIndexes.push_back(LocalPathIndex); DeleteCount++; } |