diff options
| author | Dan Engelbrecht <[email protected]> | 2025-10-24 13:22:40 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-10-24 13:22:40 +0200 |
| commit | df0f7641a5df77e4b5e00ef63458d38c8527597c (patch) | |
| tree | fd9a62f65a6f0cc74f12232cd31ab890228f8283 | |
| parent | gracefully handle broken gc dlog (#606) (diff) | |
| download | zen-df0f7641a5df77e4b5e00ef63458d38c8527597c.tar.xz zen-df0f7641a5df77e4b5e00ef63458d38c8527597c.zip | |
fixed progress bar when scanning changed local files (#608)
* fixed progress bar when scanning changed local files
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zen/cmds/builds_cmd.cpp | 51 | ||||
| -rw-r--r-- | src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h | 12 |
3 files changed, 41 insertions, 23 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e39c17aa..c37a4f268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Bugfix: Fixed ASSERT when `zen builds download` `--allow-redirect` was enabled and downloading partial block ranges - Bugfix: If disk space is below low water mark or above high water mark - only run GC if we find any data we can remove - Bugfix: If we can't run GC due to low disk space, skip GC and wait until next monitor interval to check again +- Bugfix: Fixed progress reporting when scanning for changes in local folder state ## 5.7.6 - Improvement: Oidc token executable is now launched hidden when launch from inside zenserver (oplog import/export) diff --git a/src/zen/cmds/builds_cmd.cpp b/src/zen/cmds/builds_cmd.cpp index 143f567af..c5b9c4d70 100644 --- a/src/zen/cmds/builds_cmd.cpp +++ b/src/zen/cmds/builds_cmd.cpp @@ -1805,33 +1805,36 @@ namespace { ProgressBar ProgressBar(ProgressMode, "Scan Files"); FilteredRate FilteredBytesHashed; FilteredBytesHashed.Start(); + ChunkingStatistics LocalChunkingStats; ChunkedFolderContent UpdatedLocalContent = ChunkFolderContent( - ChunkingStats, + LocalChunkingStats, GetIOWorkerPool(), Path, UpdatedContent, ChunkController, GetUpdateDelayMS(ProgressMode), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t) { - FilteredBytesHashed.Update(ChunkingStats.BytesHashed.load()); + FilteredBytesHashed.Update(LocalChunkingStats.BytesHashed.load()); std::string Details = fmt::format("{}/{} ({}/{}, {}B/s) scanned, {} ({}) chunks found", - ChunkingStats.FilesProcessed.load(), + LocalChunkingStats.FilesProcessed.load(), UpdatedContent.Paths.size(), - NiceBytes(ChunkingStats.BytesHashed.load()), + NiceBytes(LocalChunkingStats.BytesHashed.load()), NiceBytes(ByteCountToScan), NiceNum(FilteredBytesHashed.GetCurrent()), - ChunkingStats.UniqueChunksFound.load(), - NiceBytes(ChunkingStats.UniqueBytesFound.load())); + LocalChunkingStats.UniqueChunksFound.load(), + NiceBytes(LocalChunkingStats.UniqueBytesFound.load())); ProgressBar.UpdateState({.Task = "Scanning files ", .Details = Details, .TotalCount = ByteCountToScan, - .RemainingCount = ByteCountToScan - ChunkingStats.BytesHashed.load(), + .RemainingCount = ByteCountToScan - LocalChunkingStats.BytesHashed.load(), .Status = ProgressBar::State::CalculateStatus(IsAborted, IsPaused)}, false); }, AbortFlag, PauseFlag); + ChunkingStats += LocalChunkingStats; + FilteredBytesHashed.Stop(); ProgressBar.Finish(); if (AbortFlag) @@ -1906,33 +1909,34 @@ namespace { ProgressBar ProgressBar(ProgressMode, "Scan Files"); FilteredRate FilteredBytesHashed; FilteredBytesHashed.Start(); + ChunkingStatistics LocalChunkingStats; ChunkedFolderContent UpdatedLocalContent = ChunkFolderContent( - ChunkingStats, + LocalChunkingStats, GetIOWorkerPool(), Path, UpdatedContent, ChunkController, GetUpdateDelayMS(ProgressMode), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t) { - FilteredBytesHashed.Update(ChunkingStats.BytesHashed.load()); + FilteredBytesHashed.Update(LocalChunkingStats.BytesHashed.load()); std::string Details = fmt::format("{}/{} ({}/{}, {}B/s) scanned, {} ({}) chunks found", - ChunkingStats.FilesProcessed.load(), + LocalChunkingStats.FilesProcessed.load(), UpdatedContent.Paths.size(), - NiceBytes(ChunkingStats.BytesHashed.load()), + NiceBytes(LocalChunkingStats.BytesHashed.load()), NiceBytes(ByteCountToScan), NiceNum(FilteredBytesHashed.GetCurrent()), - ChunkingStats.UniqueChunksFound.load(), - NiceBytes(ChunkingStats.UniqueBytesFound.load())); + LocalChunkingStats.UniqueChunksFound.load(), + NiceBytes(LocalChunkingStats.UniqueBytesFound.load())); ProgressBar.UpdateState({.Task = "Scanning files ", .Details = Details, .TotalCount = ByteCountToScan, - .RemainingCount = ByteCountToScan - ChunkingStats.BytesHashed.load(), + .RemainingCount = ByteCountToScan - LocalChunkingStats.BytesHashed.load(), .Status = ProgressBar::State::CalculateStatus(IsAborted, IsPaused)}, false); }, AbortFlag, PauseFlag); - + ChunkingStats += LocalChunkingStats; FilteredBytesHashed.Stop(); ProgressBar.Finish(); if (!AbortFlag) @@ -1955,33 +1959,34 @@ namespace { ProgressBar ProgressBar(ProgressMode, "Scan Files"); FilteredRate FilteredBytesHashed; FilteredBytesHashed.Start(); + ChunkingStatistics LocalChunkingStats; LocalContent = ChunkFolderContent( - ChunkingStats, + LocalChunkingStats, GetIOWorkerPool(), Path, OutLocalFolderContent, ChunkController, GetUpdateDelayMS(ProgressMode), [&](bool IsAborted, bool IsPaused, std::ptrdiff_t) { - FilteredBytesHashed.Update(ChunkingStats.BytesHashed.load()); + FilteredBytesHashed.Update(LocalChunkingStats.BytesHashed.load()); std::string Details = fmt::format("{}/{} ({}/{}, {}B/s) scanned, {} ({}) chunks found", - ChunkingStats.FilesProcessed.load(), + LocalChunkingStats.FilesProcessed.load(), OutLocalFolderContent.Paths.size(), - NiceBytes(ChunkingStats.BytesHashed.load()), + NiceBytes(LocalChunkingStats.BytesHashed.load()), NiceBytes(ByteCountToScan), NiceNum(FilteredBytesHashed.GetCurrent()), - ChunkingStats.UniqueChunksFound.load(), - NiceBytes(ChunkingStats.UniqueBytesFound.load())); + LocalChunkingStats.UniqueChunksFound.load(), + NiceBytes(LocalChunkingStats.UniqueBytesFound.load())); ProgressBar.UpdateState({.Task = "Scanning files ", .Details = Details, .TotalCount = ByteCountToScan, - .RemainingCount = (ByteCountToScan - ChunkingStats.BytesHashed.load()), + .RemainingCount = (ByteCountToScan - LocalChunkingStats.BytesHashed.load()), .Status = ProgressBar::State::CalculateStatus(IsAborted, IsPaused)}, false); }, AbortFlag, PauseFlag); - + ChunkingStats += LocalChunkingStats; FilteredBytesHashed.Stop(); ProgressBar.Finish(); if (AbortFlag) diff --git a/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h b/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h index a4f22f4df..eb6ba19aa 100644 --- a/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h +++ b/src/zenremotestore/include/zenremotestore/chunking/chunkedcontent.h @@ -132,6 +132,18 @@ struct ChunkingStatistics std::atomic<uint64_t> UniqueSequencesFound = 0; std::atomic<uint64_t> UniqueBytesFound = 0; uint64_t ElapsedWallTimeUS = 0; + + inline ChunkingStatistics& operator+=(const ChunkingStatistics& Rhs) + { + FilesProcessed += Rhs.FilesProcessed; + FilesChunked += Rhs.FilesChunked; + BytesHashed += Rhs.BytesHashed; + UniqueChunksFound += Rhs.UniqueChunksFound; + UniqueSequencesFound += Rhs.UniqueSequencesFound; + UniqueBytesFound += Rhs.UniqueBytesFound; + ElapsedWallTimeUS += Rhs.ElapsedWallTimeUS; + return *this; + } }; ChunkedFolderContent ChunkFolderContent(ChunkingStatistics& Stats, |