Skip to content

[orchagent]: Consume FDB LEARN/AGED/MOVE events from ProducerStateTable - #4533

Open
xq9mend wants to merge 5 commits into
sonic-net:masterfrom
xq9mend:fix/fdb-producer-state-table
Open

[orchagent]: Consume FDB LEARN/AGED/MOVE events from ProducerStateTable#4533
xq9mend wants to merge 5 commits into
sonic-net:masterfrom
xq9mend:fix/fdb-producer-state-table

Conversation

@xq9mend

@xq9mend xq9mend commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

What I did

Add ConsumerStateTable consumer for FDB_EVENT_STATE table in FdbOrch. LEARN/AGED/MOVE events are now dispatched via doTask(Consumer&) with key-based dedup, so MAC flap storms collapse to one entry per MAC+BVID.

The existing NotificationConsumer path (PUBLISH/SUBSCRIBE) now handles only FLUSH events plus a fallback safety-net for any non-FLUSH events that arrive during transition or in ZeroMQ mode.

Also renames the local sai_fdb_type variable to fdb_type in the NotificationConsumer loop to avoid shadowing.

Why I did it

MAC flap storms generate a large number of FDB notifications for the same MAC+BVID in quick succession. With the previous PUBLISH path, each event was queued independently, causing memory pressure and processing delays. ProducerStateTable provides key-based deduplication: multiple events for the same MAC+BVID are merged so only the latest state is processed.

How I verified it

VS tests: all 15 FDB tests pass (test_fdb.py, test_fdbsync.py, test_fdb_update.py).

Details if related

Depends on sonic-sairedis change: sonic-net/sonic-sairedis#1875

@xq9mend
xq9mend requested a review from prsunny as a code owner April 29, 2026 06:42
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@xq9mend

xq9mend commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

xq9mend added a commit to xq9mend/sonic-buildimage that referenced this pull request Apr 30, 2026
…able

Update src/sonic-sairedis to ae644aa9:
  Route FDB LEARN/AGED/MOVE events via ProducerStateTable for key-based dedup

Update src/sonic-swss to 50abedff:
  Consume FDB LEARN/AGED/MOVE events from ProducerStateTable

Related PRs:
  sonic-sairedis: sonic-net/sonic-sairedis#1875
  sonic-swss: sonic-net/sonic-swss#4533

Signed-off-by: xq9mend <xq9mend@users.noreply.github.com>
xq9mend added a commit to xq9mend/sonic-buildimage that referenced this pull request Apr 30, 2026
…able

Update src/sonic-sairedis to ae644aa9:
  Route FDB LEARN/AGED/MOVE events via ProducerStateTable for key-based dedup

Update src/sonic-swss to 50abedff:
  Consume FDB LEARN/AGED/MOVE events from ProducerStateTable

Related PRs:
  sonic-sairedis: sonic-net/sonic-sairedis#1875
  sonic-swss: sonic-net/sonic-swss#4533

Signed-off-by: xq9mend <xq9mend@users.noreply.github.com>
@prsunny

prsunny commented May 15, 2026

Copy link
Copy Markdown
Collaborator

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

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 moves FDB LEARN/AGED/MOVE handling toward an ASIC_DB ConsumerStateTable path so repeated MAC+BVID events can be deduplicated before FdbOrch processes them, while keeping notification handling for FLUSH and fallback events.

Changes:

  • Adds FDB_EVENT_STATE table constant and registers a ConsumerStateTable executor in FdbOrch.
  • Adds doTask(Consumer&) handling for deduplicated FDB event state entries.
  • Updates FDB notification-path comments and renames a local FDB type variable.

Reviewed changes

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

File Description
orchagent/fdborch.h Defines the ASIC FDB event state table name.
orchagent/fdborch.cpp Adds the new FDB event consumer and processing path, while retaining notification fallback handling.

Comment thread orchagent/fdborch.cpp
* These arrive with key-based dedup — multiple events for same MAC+BVID
* are merged by ConsumerStateTable, solving the MAC flap memory storm.
*/
if (table_name == ASIC_FDB_EVENT_STATE_TABLE)
Comment thread orchagent/fdborch.cpp
}
}

this->update(event_type, &fdb_entry, bridge_port_id, sai_fdb_type);
Add ConsumerStateTable consumer for FDB_EVENT_STATE table in FdbOrch.
LEARN/AGED/MOVE events are now dispatched via doTask(Consumer&) with
key-based dedup, so MAC flap storms collapse to one entry per MAC+BVID.

The existing NotificationConsumer path (PUBLISH/SUBSCRIBE) now handles
only FLUSH events plus a fallback safety-net for any non-FLUSH events
that arrive during transition or in ZeroMQ mode.

Also renames the local sai_fdb_type variable to fdb_type in the
NotificationConsumer loop to avoid shadowing.

Signed-off-by: xq9mend <xq9mend@users.noreply.github.com>
@xq9mend
xq9mend force-pushed the fix/fdb-producer-state-table branch from 6e4b95b to 4c6ea11 Compare June 17, 2026 01:40
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

The installed saimetadata.h in CI has sai_deserialize_fdb_event with
C-style signature (const char*, sai_fdb_event_t*). Use .c_str() and
pass pointer to match.

Signed-off-by: xq9mend <xq9mend@users.noreply.github.com>
@xq9mend
xq9mend force-pushed the fix/fdb-producer-state-table branch from 4c6ea11 to 06840af Compare June 23, 2026 04:04
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@xq9mend

xq9mend commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

CI status: Same systemic vstest/p4rt infra failure as affecting all sonic-swss-common and related PRs since June 8. Not caused by this change.

This PR consumes FDB LEARN/AGED/MOVE events from ProducerStateTable (companion to sonic-sairedis#1875) and is code-complete. Requesting a merge bypass given the known-broken vstest infra. CC @lolyu @croos12 @prsunny @Ndancejic

@prabhataravind

Copy link
Copy Markdown
Contributor

@xq9mend Given that #4586 solved the MAC storm problem conservatively, what incremental value does key-based dedup add that justifies the event-collapse correctness risks?

Signed-off-by: xq9mend <xq9mend@users.noreply.github.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Signed-off-by: xq9mend <xq9mend@users.noreply.github.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Signed-off-by: xq9mend <xq9mend@users.noreply.github.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

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.

5 participants