Skip to content

C++ KVS Does Not Update Snapshot Count on First Flush #192

@Saumya-R

Description

@Saumya-R

The C++ implementation of the KVS does not increment the snapshot count after the first flush. The snapshot count only starts updating from the second flush onward.

Steps to Reproduce

  • Run the C++ test binary with a scenario like:
    --name cit.snapshots.count --input '{"kvs_parameters": {"instance_id": 1, "dir": "/tmp/test", "snapshot_max_count": 1}, "count": 3}'
  • Observe the log output for snapshot_count.

Expected Behavior

  • The snapshot count should increment after every flush, starting from the first flush.
  • For count=3, snapshot_max_count=1, the expected log sequence is: [0, 1, 1, 1] (0 before any flush, then 1 after each flush, capped at max).

Observed Behavior

  • The log output is: [0, 0, 1, 2] or [0, 0, 1, ...]
  • The first flush does not increment the snapshot count; the count only increases after the second flush.

Root Cause

  • The C++ implementation does not update the snapshot count after the first flush.
  • The logic for incrementing the snapshot count is not triggered on the first flush, leading to an off-by-one error in the log output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions