Skip to content

feat: make KVS max snapshot count configurable - #383

Open
atarekra wants to merge 3 commits into
eclipse-score:mainfrom
Valeo-S-CORE-Organization:kvs-configurable-max-snapshots
Open

feat: make KVS max snapshot count configurable#383
atarekra wants to merge 3 commits into
eclipse-score:mainfrom
Valeo-S-CORE-Organization:kvs-configurable-max-snapshots

Conversation

@atarekra

Copy link
Copy Markdown
Contributor

The C++ KVS fixed the number of snapshots at three via the KVS_MAX_SNAPSHOTS macro, so comp_req__kvs__snapshot_max_num ("configurable maximum number of snapshots") was not met and the component integration tests xfailed all C++ boundary cases.

Replace the macro with a namespaced KVS_DEFAULT_MAX_SNAPSHOTS constant and add KvsBuilder::snapshot_max_count(), forwarded through Kvs::open() into a per-instance member used by snapshot counting, rotation and the reported maximum. The value is bound at init-time and immutable afterwards, since lowering it on a live store would orphan snapshot files that rotation would never reclaim.

A configured maximum of zero keeps no previous generation but still persists the current KVS data, matching the Rust backend, which rotates (a no-op at zero) and then always saves snapshot 0.

Also fix SnapshotMaxCount::run reading a "count" field its scenario config never supplies, which the blanket xfail had been hiding.

Resolves #108

The C++ KVS fixed the number of snapshots at three via the
KVS_MAX_SNAPSHOTS macro, so comp_req__kvs__snapshot_max_num
("configurable maximum number of snapshots") was not met and the
component integration tests xfailed all C++ boundary cases.

Replace the macro with a namespaced KVS_DEFAULT_MAX_SNAPSHOTS
constant and add KvsBuilder::snapshot_max_count(), forwarded through
Kvs::open() into a per-instance member used by snapshot counting,
rotation and the reported maximum. The value is bound at init-time
and immutable afterwards, since lowering it on a live store would
orphan snapshot files that rotation would never reclaim.

A configured maximum of zero keeps no previous generation but still
persists the current KVS data, matching the Rust backend, which
rotates (a no-op at zero) and then always saves snapshot 0.

Also fix SnapshotMaxCount::run reading a "count" field its scenario
config never supplies, which the blanket xfail had been hiding.
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 9cb1ef33-c400-4132-9078-983dd23d7d39
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 3 packages loaded
Analyzing: target //:license-check (4 packages loaded, 0 targets configured)
Analyzing: target //:license-check (4 packages loaded, 0 targets configured)

Analyzing: target //:license-check (58 packages loaded, 10 targets configured)

Analyzing: target //:license-check (90 packages loaded, 10 targets configured)

Analyzing: target //:license-check (143 packages loaded, 408 targets configured)

Analyzing: target //:license-check (149 packages loaded, 3125 targets configured)

Analyzing: target //:license-check (149 packages loaded, 3125 targets configured)

Analyzing: target //:license-check (149 packages loaded, 3125 targets configured)

Analyzing: target //:license-check (163 packages loaded, 6228 targets configured)

Analyzing: target //:license-check (163 packages loaded, 6228 targets configured)

Analyzing: target //:license-check (169 packages loaded, 6279 targets configured)

Analyzing: target //:license-check (171 packages loaded, 8411 targets configured)

Analyzing: target //:license-check (176 packages loaded, 11384 targets configured)

Analyzing: target //:license-check (177 packages loaded, 11510 targets configured)

INFO: Analyzed target //:license-check (177 packages loaded, 11510 targets configured).
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 66 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
[15 / 17] [Prepa] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar
[16 / 17] Building license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 34.586s, Critical Path: 2.57s
INFO: 17 processes: 12 internal, 4 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 17 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@Ahmed-Elsaka-JC

Copy link
Copy Markdown
Contributor

@atarekra please resolve merge conflicts

@atarekra

Copy link
Copy Markdown
Contributor Author

@atarekra please resolve merge conflicts

Solved

@arkjedrz arkjedrz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small issue, otherwise LGTM.

Comment thread score/kvs/kvsbuilder.cpp Outdated
Signed-off-by: atarekra <ahmed.tarek-ramadan@valeo.com>
@atarekra
atarekra deployed to workflow-approval September 1, 2026 10:35 — with GitHub Actions Active
@atarekra
atarekra deployed to workflow-approval September 1, 2026 10:35 — with GitHub Actions Active
Comment thread score/kvs/kvsbuilder.cpp

KvsBuilder& KvsBuilder::snapshot_max_count(std::size_t max_count)
{
this->max_snapshots = max_count;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if maximum snapshot >=3 set it to 3

@umaucher umaucher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see @Ahmed-Elsaka-JC commend

Comment thread score/kvs/kvs.hpp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::size_t snapshot_max_count = KVS_DEFAULT_MAX_SNAPSHOTS :
why do you use default value for snapshot_max_count again here ?? this default would be set but builder constructor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvement: set KVS_MAX_SNAPSHOTS as configuration parameter

4 participants