Skip to content

hamgrd: ignore DPU HA set/scope state deletion messages#206

Merged
vivekrnv merged 1 commit into
sonic-net:masterfrom
BYGX-wcr:fix/ignore-dpu-ha-state-deletions
Jul 10, 2026
Merged

hamgrd: ignore DPU HA set/scope state deletion messages#206
vivekrnv merged 1 commit into
sonic-net:masterfrom
BYGX-wcr:fix/ignore-dpu-ha-state-deletions

Conversation

@BYGX-wcr

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

Copy link
Copy Markdown
Contributor

Description of PR

get_dpu_ha_set_state and get_dpu_ha_scope_state previously deserialized every incoming DASH_HA_SET_STATE / DASH_HA_SCOPE_STATE message regardless of the DB operation. A Del message carries empty field values, so it could be misinterpreted as an (empty) state update rather than being ignored.

This PR adds an explicit KeyOperation::Del check to both accessors so deletion notifications are logged at debug level and skipped (returning None), which causes the callers to ignore them.

Type of change

Approach

How it works: Both accessor functions now inspect kfv.operation after deserializing the KeyOpFieldValues. When the operation is KeyOperation::Del, they return None early instead of attempting to deserialize the (empty) field values.

How it was verified: cargo test -p hamgrd — all 41 unit tests pass, including the ha_set and ha_scope NPU/DPU suites.

get_dpu_ha_set_state and get_dpu_ha_scope_state now return None when the incoming DASH_HA_SET_STATE / DASH_HA_SCOPE_STATE message is a KeyOperation::Del, so deletion notifications are ignored instead of being treated as (empty) state updates.

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

Copy link
Copy Markdown

/azp 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

Fixes a hamgrd edge case where DASH_HA_SET_STATE / DASH_HA_SCOPE_STATE deletion notifications (which carry empty field values) could be misinterpreted as empty state updates by adding explicit KeyOperation::Del guards in the DPU state accessors.

Changes:

  • Skip DASH_HA_SET_STATE messages whose KeyOpFieldValues.operation is Del (log at debug, return None).
  • Skip DASH_HA_SCOPE_STATE messages whose KeyOpFieldValues.operation is Del (log at debug, return None).

Reviewed changes

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

File Description
crates/hamgrd/src/actors/ha_set.rs Ignore DASH_HA_SET_STATE delete notifications before deserializing empty field values into a state update.
crates/hamgrd/src/actors/ha_scope/base.rs Ignore DASH_HA_SCOPE_STATE delete notifications before deserializing empty field values into a state update.

@vivekrnv

Copy link
Copy Markdown
Contributor

Ran the test and didn't observe any failures

@vivekrnv
vivekrnv merged commit b5bab5c into sonic-net:master Jul 10, 2026
4 checks passed
@BYGX-wcr
BYGX-wcr deleted the fix/ignore-dpu-ha-state-deletions branch July 10, 2026 20:05
@mssonicbld

Copy link
Copy Markdown

Cherry-pick PR to 202605: #207

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: [HA] hamgrd logs deserialization errors for HA state delete messages without last_updated_time

4 participants