cm: imagemanager: limit number of stored item versions - #641
Merged
al1img merged 1 commit intoAug 12, 2026
Conversation
al1img
reviewed
Aug 11, 2026
| /** | ||
| * Max number of versions stored per update item. | ||
| */ | ||
| constexpr auto cMaxNumItemVersions = 2; |
Collaborator
There was a problem hiding this comment.
Why do you need it in public? It could be private consts.
Author
There was a problem hiding this comment.
to calculate this one
constexpr auto cMaxNumStoredItems = cMaxNumUpdateItems * cMaxNumItemVersions;
in this case than i need to repeat in here
MykolaSuperman
force-pushed
the
fix/cm-item-versions-limit
branch
from
August 11, 2026 14:08
c4ba2a6 to
1df9e2e
Compare
al1img
approved these changes
Aug 11, 2026
al1img
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
CM kept every removed item version in storage until updateItemTTL expired (30d by default), while all read buffers were sized against cMaxNumItemVersions (2). On the third consecutive update of the same item GetItemInfos() overflowed its array and the launcher failed with "can't add item info", leaving the instance unable to start. Trim the oldest removed versions before adding a new one, the way SM does it in RemoveOldItemVersions(), so an item never exceeds cMaxNumItemVersions rows. An installed version is never force removed: if no removed version is left to reclaim, the trim just stops. Add cMaxNumStoredItems to size the buffers holding the whole table: GetAllItemsInfos() ones counted items instead of rows and would have overflowed the same way past 64 rows. Signed-off-by: Mykola Solianko <mykola_solianko@epam.com> Reviewed-by: Mykola Kobets <mykola_kobets@epam.com> Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
MykolaSuperman
force-pushed
the
fix/cm-item-versions-limit
branch
from
August 11, 2026 14:20
1df9e2e to
bd4fb3f
Compare
|
mykola-kobets-epam
approved these changes
Aug 11, 2026
mykola-kobets-epam
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed-by: Mykola Kobets <mykola_kobets@epam.com>
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.


CM kept every removed item version in storage until updateItemTTL expired (30d by default), while all read buffers were sized against cMaxNumItemVersions (2). On the third consecutive update of the same item GetItemInfos() overflowed its array and the launcher failed with "can't add item info", leaving the instance unable to start.
Trim the oldest removed versions before adding a new one, the way SM does it in RemoveOldItemVersions(), so an item never exceeds cMaxNumItemVersions rows. An installed version is never force removed: if no removed version is left to reclaim, the trim just stops.
Move cMaxNumItemVersions to the storage interface as it now describes a storage invariant, and add cMaxNumStoredItems for the whole table. GetAllItemsInfos() buffers counted items instead of rows and would have overflowed the same way past 64 rows, so size them accordingly.