Skip to content

Add exact Redis Stream trimming support - #104

Merged
derekste merged 1 commit into
mainfrom
dev/exact-stream-trim
Aug 11, 2026
Merged

Add exact Redis Stream trimming support#104
derekste merged 1 commit into
mainfrom
dev/exact-stream-trim

Conversation

@derekste

@derekste derekste commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

  • add an RA_ArgsAdd::approximateTrim option for Redis Stream writes
  • preserve the existing approximate MAXLEN ~ behavior by default
  • allow callers with a hard memory or entry-count contract to request exact
    MAXLEN = trimming
  • cover exact retention in the Redis-backed test suite and document the new
    argument

Motivation

Image streams can contain multi-megabyte entries, so Redis's approximate trim
may materially exceed a configured memory budget. The AreaDetector Redis data
plane uses this option to retain exactly 16 recent frames while keeping the
existing behavior unchanged for all current callers.

Verification

  • the new test writes ten values with a retention of three and verifies the
    exact final entries
  • ADRedis builds against this branch in the full ADAravis IOC image
  • the deployed GE1350 stream remained exactly 16 entries during a 600-frame
    real-camera comparison and concurrent PVA/video fanout

Copilot AI lite review requested due to automatic review settings August 7, 2026 02:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a caller-controlled switch to choose between Redis Stream approximate trimming (MAXLEN ~) and exact trimming (MAXLEN =) when writing stream entries via RedisAdapter, while keeping approximate trimming as the default for backward compatibility and throughput.

Changes:

  • Extend RA_ArgsAdd with approximateTrim (default true) to allow opting into exact MAXLEN = trimming.
  • Thread the new option through all stream-write paths (addSingleValue, addSingleDouble, addSingleList).
  • Add a Redis-backed test validating exact retention behavior and document the new argument in the API docs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test.cpp Adds ExactTrim test validating strict retention when approximateTrim=false.
RedisAdapterTempl.hpp Passes approximateTrim through templated stream write helpers to xaddTrim.
RedisAdapter.hpp Adds RA_ArgsAdd::approximateTrim and wires it through addSingleList overloads + helper declaration.
RedisAdapter.cpp Wires approximateTrim through the addSingleDouble stream write path.
mock/MockRedisAdapter.hpp Keeps mock RA_ArgsAdd in sync with the real adapter’s argument struct.
docs/api.md Documents the new RA_ArgsAdd.approximateTrim behavior and default.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@derekste
derekste requested review from a team, bigsamich, d4vebr4cey and wsulli August 7, 2026 12:13
@derekste
derekste merged commit 42cae0c into main Aug 11, 2026
2 checks passed
@derekste
derekste deleted the dev/exact-stream-trim branch August 11, 2026 12:08
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.

3 participants