[dhcpmon] Cleanup stale v6 counters from COUNTERS_DB#74
Open
Xichen96 wants to merge 1 commit into
Open
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
`cleanup_stale_db_counters()` was added in PR sonic-net#62 alongside the v6 support, but it only scans `DHCPV4_COUNTER_TABLE:` keys. As a result, stale `DHCPV6_COUNTER_TABLE:` entries (e.g. interfaces removed from a VLAN, or VLANs that flipped between dhcpv4_relay and dhcpv6_relay configs) are never deleted from COUNTERS_DB. Wrap the existing match/delete logic in a loop over `{false, true}` so both DHCPV4_COUNTER_TABLE and DHCPV6_COUNTER_TABLE prefixes are scanned. Both call sites — startup (`initialize_all_intf_counters()`) and the periodic `db_update_callback()` — pick up the v6 path automatically. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Xichen96 <lukelin0907@gmail.com>
3299183 to
7fc6cab
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
Follow-up to PR #62 (DHCPv6 support).
cleanup_stale_db_counters()only scansDHCPV4_COUNTER_TABLE:*keys, so staleDHCPV6_COUNTER_TABLE:*entries (e.g. interfaces removed from a VLAN, or a VLAN that flipped between dhcpv4_relay and dhcpv6_relay configs) are never purged from COUNTERS_DB.Work item tracking
How I did it
Wrap the existing match/delete logic in
for (bool is_v6 : {false, true})and passis_v6toconstruct_counter_db_table_key(). Both call sites — startup (initialize_all_intf_counters()) and the periodicdb_update_callback()— pick up the v6 path automatically.How to verify it
On a v6-relay testbed, remove an interface from a Vlan (or flip its relay config from v6 back to v4) and confirm that the corresponding
DHCPV6_COUNTER_TABLE:<vlan>:<ifname>entry is removed from COUNTERS_DB after the nextdb_update_callback()tick.Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)