Skip to content

swss-common-bridge: replay unchanged producer updates - #210

Merged
BYGX-wcr merged 1 commit into
sonic-net:masterfrom
BYGX-wcr:fix/swss-common-bridge-replay-updates
Jul 28, 2026
Merged

swss-common-bridge: replay unchanged producer updates#210
BYGX-wcr merged 1 commit into
sonic-net:masterfrom
BYGX-wcr:fix/swss-common-bridge-replay-updates

Conversation

@BYGX-wcr

@BYGX-wcr BYGX-wcr commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Description of PR

Summary:
The producer bridge cached the last update and skipped identical requests. That cache can outlive a DPU control-plane reset, so an HA_SET entry removed from the destination DB was not restored when hamgrd replayed unchanged data. Always apply valid producer requests so replay can recover externally lost DB state. Consumer-side caching remains unchanged.

Fixes: sonic-net/sonic-buildimage#28073

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation update
  • Test improvement

Approach

What is the motivation for this PR?

A DPU control-plane reset can clear DASH_HA_SET_TABLE while swss-common-bridge remains running. Replaying the same HA_SET data previously returned "No change in data" without writing it, leaving the destination DB entry missing.

How did you do it?

  • Removed producer-side TableCache deduplication.
  • Apply every valid Set or Del request to the ProducerTable.
  • Kept TableCache for consumer-side incremental merge and duplicate-notification filtering.
  • Updated duplicate and ZMQ consumer-recreation tests to require identical updates to be replayed.

How did you verify/test it?

  • cargo fmt --check --all
  • cargo build --workspace --all-features
  • cargo test -p swss-common-bridge (9 passed)
  • Built the Debian runtime and debug-symbol packages.
  • Installed and verified the packages in dash-hadpu0 through dash-hadpu3 on two SmartSwitches.
  • Completed config reload on both switches and verified all eight hamgrd processes were running.

Any platform specific information?

Validated on SONiC SmartSwitch DPU containers using both Redis ProducerStateTable and ZmqProducerStateTable paths.

Documentation

No documentation change is required; this restores producer replay correctness without changing the public interface.

Signed-off-by: BYGX-wcr <wcr@live.cn>
Copilot AI review requested due to automatic review settings July 27, 2026 21:26
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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 fixes a producer-side replay correctness issue in swss-common-bridge where identical producer updates were previously deduplicated and skipped. Because that dedup cache could outlive an external DB state loss (e.g., DPU control-plane reset clearing DASH_HA_SET_TABLE), hamgrd replays of unchanged data would not restore missing entries; the bridge now always applies valid producer requests so external state loss can be recovered.

Changes:

  • Removed producer-side TableCache deduplication so identical SET/DEL requests are always applied to the ProducerTable.
  • Updated tests to require identical updates to be replayed (including after ZMQ consumer recreation).
  • Narrowed TableCache’s documented purpose to consumer-side merge + duplicate-notification filtering and removed the producer-oriented replace_kfv API.

Reviewed changes

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

File Description
crates/swss-common-bridge/src/producer.rs Always applies producer requests (no dedup) and updates tests to assert identical updates are replayed.
crates/swss-common-bridge/src/lib.rs Updates TableCache docs to consumer-only semantics and removes producer-side replace_kfv dedup method.

@BYGX-wcr
BYGX-wcr merged commit 68f8cce into sonic-net:master Jul 28, 2026
4 checks passed
@BYGX-wcr
BYGX-wcr deleted the fix/swss-common-bridge-replay-updates branch July 28, 2026 22:05
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.

Bug: [Err Log] [SmartSwitch] [HA] ERR swss#orchagent: :- addHaScopeEntry: HA Set entry does not exist for haset0_0

4 participants