Fix imagemanager allocation - #593
Open
MykolaSuperman wants to merge 4 commits into
Open
Conversation
added 3 commits
June 18, 2026 16:51
ResizeSpace called Partition::Free + Partition::Allocate which toggled mAllocationCount on every resize. Since mAllocationCount > 0 suppresses disk re-reads, mAvailableSize became stale and lazy eviction stopped triggering, leading to ENOSPC on subsequent allocations. Add Partition::AdjustSize that adjusts mAvailableSize and triggers eviction when needed without touching mAllocationCount. ResizeSpace now calls AdjustSize instead of the Free/Allocate pair on the partition, keeping mAllocationCount as a pure count of live Space objects. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
RemoveOrphans sweeps the disk and deletes everything not referenced by any DB item. Blobs and layer dirs for concurrently-installing items are on disk but not yet committed to DB, so they were deleted as orphans. Before calling RemoveOrphanBlobs and RemoveOrphanLayers, add the blob path and corresponding layer dir path for every digest in mInProgressBlobs to the respective used-sets. This prevents the sweep from touching files that belong to an in-progress installation. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
… deletion RemoveOrphans sweeps the entire disk and deletes everything not referenced by the DB. When called from RemoveItem during eviction, it raced with concurrent installs: files on disk but not yet in DB were deleted as orphans, causing "Failed to unpack layer" errors. Replace the RemoveOrphans call in RemoveItem with targeted deletion: 1. Collect the blobs/layers still needed by all remaining DB items (CalcRemainingBlobsAndLayers, skipping the evicted item). 2. Load the evicted item's own manifest to enumerate exactly what it owns (FindUpdateItemData + DeleteEvictedItemFiles). 3. Delete only the evicted item's exclusive files, blobs and layers not present in the remaining set. RemoveOrphans is retained as a fallback for the allocation-failure path where no item data is available. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #593 +/- ##
===========================================
- Coverage 84.98% 84.66% -0.32%
===========================================
Files 325 325
Lines 29036 29155 +119
Branches 3896 3943 +47
===========================================
+ Hits 24677 24685 +8
- Misses 4359 4470 +111 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…llation When a download is cancelled to process a new desired status, mCancel is set to true. Once the cancelled download finishes and mInProgress becomes false, a subsequent DownloadUpdateItems call would enter StartAction and immediately return false because mCancel was still set, causing the new download to fail with eCanceled without attempting any network activity. Only reject starting a new action when mCancel is true and mInProgress is also true, meaning there is an active download being cancelled. A stale mCancel with no in-progress action should not block the next download. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
|
al1img
reviewed
Jun 23, 2026
| * @param newSize new size to reserve. | ||
| * @return Error. | ||
| */ | ||
| Error AdjustSize(size_t oldSize, size_t newSize) |
Collaborator
There was a problem hiding this comment.
Rename method to Resize. It looks like we can keep only one parameter as deltaSize. It could be positive and negative in the general case. In case negative delta size we can just update mAvailableSize for positive delta size we shuould check if there is enough available space and try to remove outdated items.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.