sonic-net / sonic-swss

SONiC Switch State Service (SwSS)
https://azure.github.io/SONiC
Other
179 stars 538 forks source link

Stale Counter db table exists even after rif is deleted. #2193

Open sumanbrcm opened 2 years ago

sumanbrcm commented 2 years ago

Description SONiC maintains rif counter statistics in COUNTER_DB with the the help of 4 tables. They are needed for displaying packets/bytes as well as rates in tx/tx direction. These tables are accessed by object-id(OID) for the corresponding RIF. The RIF - OID is maintained in another counter-db table COUNTERS_RIF_NAME_MAP. But once RIF is deleted, although the mapping is deleted , but the 4 tables do not get deleted and remain as stale.

Steps to reproduce the issue:

  1. Create Vlan and make it a member of any port
  2. Assign ip to this vlan
  3. Check counter db and check the oid for this in "COUNTERS_RIF_NAME_MAP"
  4. Check the tables which have got created for the oid.
  5. Delete the ip from vlan (rif gets deleted)
  6. Check the counter db , the tables still exists for those oid.

Describe the results you received: Upon execution of the steps , after RIF was deleted the stale table still existed in COUNTERS DB. For clarity the exact CLI is also shown as below . After deletion of RIF, the stale table exists which is shown in step 6 .

  1. sudo config vlan add 100 sudo config vlan member add 100 Ethernet48
  2. sudo config interface ip add Vlan100 100.100.100.1/24
  3. redis-cli -n 2 HGETALL "COUNTERS_RIF_NAME_MAP" 127) "Vlan100" 128) "oid:0x6000000000ba6"
  4. 127.0.0.1:6379[2]> keys *6000000000ba6* 1) "COUNTERS:oid:0x6000000000ba6" 2) "RATES:oid:0x6000000000ba6" 3) "RATES:oid:0x6000000000ba6:RIF" 127.0.0.1:6379[2]>
  5. sudo config interface ip remove Vlan100 100.100.100.1/24
  6. 127.0.0.1:6379[2]> keys *6000000000ba6* 1) "COUNTERS:oid:0x6000000000ba6" 2) "RATES:oid:0x6000000000ba6" 3) "RATES:oid:0x6000000000ba6:RIF"

Describe the results you expected: The expectation is there should not be any stale table for any deleted/non-existing RIF.

Output of show version: admin@sonic:~$ show version

SONiC Software Version: SONiC.master.0-9ac289a88 Distribution: Debian 11.2 Kernel: 5.10.0-8-2-amd64 Build commit: 9ac289a88 Build date: Tue Mar 22 11:08:10 UTC 2022 Built by: sk408115@sonic-lvn-csg-004

Platform: x86_64-accton_as7816_64x-r0 HwSKU: Accton-AS7816-64X ASIC: broadcom ASIC Count: 1 Serial Number: N/A Model Number: N/A Hardware Revision: N/A Uptime: 18:49:58 up 33 min, 1 user, load average: 0.15, 0.61, 0.70

Docker images: REPOSITORY TAG IMAGE ID SIZE docker-orchagent latest da83f8d4ea98 462MB docker-orchagent master.0-9ac289a88 da83f8d4ea98 462MB docker-fpm-frr latest 3ee865fd5b1c 460MB docker-fpm-frr master.0-9ac289a88 3ee865fd5b1c 460MB docker-nat latest a69d62fac6ba 445MB docker-nat master.0-9ac289a88 a69d62fac6ba 445MB docker-macsec latest 5a6aa61a8668 445MB docker-macsec master.0-9ac289a88 5a6aa61a8668 445MB docker-sflow latest 8bf63e3ef39a 443MB docker-sflow master.0-9ac289a88 8bf63e3ef39a 443MB docker-teamd latest 1ee6c94c589b 442MB docker-teamd master.0-9ac289a88 1ee6c94c589b 442MB docker-platform-monitor latest 5effe289b674 541MB docker-platform-monitor master.0-9ac289a88 5effe289b674 541MB docker-snmp latest a6442486551c 471MB docker-snmp master.0-9ac289a88 a6442486551c 471MB docker-mux latest 530e7ff28531 480MB docker-mux master.0-9ac289a88 530e7ff28531 480MB docker-dhcp-relay latest 3af842692b56 449MB docker-sonic-telemetry latest 10893f4fc878 528MB docker-sonic-telemetry master.0-9ac289a88 10893f4fc878 528MB docker-database latest 2af56fc5bcab 439MB docker-database master.0-9ac289a88 2af56fc5bcab 439MB docker-syncd-brcm latest 15125617b736 805MB docker-syncd-brcm master.0-9ac289a88 15125617b736 805MB docker-gbsyncd-credo latest f2fb6158c6ba 443MB docker-gbsyncd-credo master.0-9ac289a88 f2fb6158c6ba 443MB docker-sonic-mgmt-framework latest 2e24cd014e00 582MB docker-sonic-mgmt-framework master.0-9ac289a88 2e24cd014e00 582MB docker-lldp latest 4aab8886498e 467MB docker-lldp master.0-9ac289a88 4aab8886498e 467MB docker-router-advertiser latest f4666d5d47ed 427MB docker-router-advertiser master.0-9ac289a88 f4666d5d47ed 427MB

admin@sonic:~$

Output of show techsupport:

sumanbrcm commented 2 years ago

I am submitting a PR for this issue