From 4912a770caeb8d0f6bf8e7bf7e7ede08a17ffa79 Mon Sep 17 00:00:00 2001 From: tomer-israel <76040066+tomer-israel@users.noreply.github.com> Date: Mon, 15 Nov 2021 18:48:20 +0200 Subject: [PATCH] Remove buffer drop counter when port is removed (#1860) - What I did I added the removal of port buffer drop counter on the deinit port flow. it was added to the deInitPort function. - Why I did it the buffer drop counter was never removed when port was deleted. this flex counter was create on the initPort function but it was removed when the port was deleted - How I verified it removed and created a port and check the FLEX_COUNTER redis table FLEX_COUNTER_TABLE:PORT_BUFFER_DROP_STAT table --- orchagent/portsorch.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index b58670451571..23b72dd0612c 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -2423,6 +2423,13 @@ void PortsOrch::deInitPort(string alias, sai_object_id_t port_id) { port_stat_manager.clearCounterIdList(p.m_port_id); } + + if (flex_counters_orch->getPortBufferDropCountersState()) + { + port_buffer_drop_stat_manager.clearCounterIdList(p.m_port_id); + } + + /* remove port name map from counter table */ m_counter_db->hdel(COUNTERS_PORT_NAME_MAP, alias);