Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[show priority-group drop counters] Remove backup with cached PG drop counters after 'config reload' #1679

Merged

Conversation

ayurkiv-nvda
Copy link
Contributor

Signed-off-by: Andriy Yurkiv ayurkiv@nvidia.com

What I did

Explanation how show/clear counters works:

  • Suppose we got from SDK some count of dropped packets for priority group (№3) per interface (Ehernet4). (for example Ethernet4 PG-3 123 packets)
  • Stats can be shown via show priority-group drop counters
    Then we run sonic-clear priority-group drop counters. This command will save data "Ethernet4 PG-3 123 packets" to backup. It saved in /tmp/dropstat-{user_id} folder
  • When we run show priority-group drop counters again, script will take data from SDK and data saved from backup. In backup it will find 123. In SDK it may still be number 123 for Ethernet4 (like in backup) or bigger (for example 126.)
    Our sonic-clear priority-group drop counters command does not change anything in SDK. It just show difference beetwen SDK data and last saved data.
    So if in SDK data is 123, show priority-group drop counters will show 0 (123 minus 123) - data is cleared
    If in SDK data is bigger than saved 124, or higher show priority-group drop counters will show 1 (124 minus 123)

FIX
After config reload all counters drop counters data retrieved from SDK become cleared. All counters become zeros.
In this case show priority-group drop counters will show -123 ( 0 (from SDK) minus 123 (saved backup))
So we don't need backup after config reload

How I did it

remove /tmp/dropstat-{user_id} folders with counters backup

How to verify it

  • provoke PG dropped packets (Use QoS test with prf32 topo and RPC image)
  • check that counters increased show priority-group drop counters
  • clear counter via sonic-clear priority-group drop counters
  • run sudo config reload -y
  • check that counters are zeros show priority-group drop counters

Previous command output (if the output of a command-line utility has changed)

       Port    PG0    PG1    PG2    PG3    PG4    PG5    PG6    PG7
-----------  -----  -----  -----  -----  -----  -----  -----  -----
  Ethernet0      0      0      0      0      0      0      0      0
  Ethernet4      0      0      0   -123      0      0      0      0

New command output (if the output of a command-line utility has changed)

       Port    PG0    PG1    PG2    PG3    PG4    PG5    PG6    PG7
-----------  -----  -----  -----  -----  -----  -----  -----  -----
  Ethernet0      0      0      0      0      0      0      0      0
  Ethernet4      0      0      0      0      0      0      0      0

… counters after 'config reload'

Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com>
@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

@ayurkiv-nvda please add unit test to catch the issue which will work now with the fix. if i am not mistaken config reload cannot be used in the unittest infra so please consider simulation the behaviour without a config reload.

@liat-grozovik liat-grozovik marked this pull request as ready for review June 24, 2021 13:18
@neethajohn
Copy link
Contributor

Will review once there is a testcase for this

@liat-grozovik
Copy link
Collaborator

Will review once there is a testcase for this

@neethajohn there is no infra for unit test for config reload. this was also discussed on other PRs related to changes in config reload. Do you have other suggestion?

@neethajohn
Copy link
Contributor

Will review once there is a testcase for this

@neethajohn there is no infra for unit test for config reload. this was also discussed on other PRs related to changes in config reload. Do you have other suggestion?

@ayurkiv-nvda, can you explore if you could use something similar to this
--dry-run: https://github.com/Azure/sonic-utilities/blob/master/config/main.py#L1985
Sample test: https://github.com/Azure/sonic-utilities/blob/master/tests/config_test.py#L67

Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com>
@ayurkiv-nvda
Copy link
Contributor Author

@ayurkiv-nvda please add unit test to catch the issue which will work now with the fix. if i am not mistaken config reload cannot be used in the unittest infra so please consider simulation the behaviour without a config reload.

Done

@ayurkiv-nvda
Copy link
Contributor Author

Will review once there is a testcase for this

Done

@liat-grozovik liat-grozovik merged commit 793b847 into sonic-net:master Jul 2, 2021
qiluo-msft pushed a commit that referenced this pull request Jul 7, 2021
… counters after 'config reload' (#1679)

- What I did
Explanation how show/clear counters works:

Suppose we got from SDK some count of dropped packets for priority group (№3) per interface (Ehernet4). (for example Ethernet4 PG-3 123 packets)
Stats can be shown via show priority-group drop counters
Then we run sonic-clear priority-group drop counters. This command will save data "Ethernet4 PG-3 123 packets" to backup. It saved in /tmp/dropstat-{user_id} folder
When we run show priority-group drop counters again, script will take data from SDK and data saved from backup. In backup it will find 123. In SDK it may still be number 123 for Ethernet4 (like in backup) or bigger (for example 126.)
Our sonic-clear priority-group drop counters command does not change anything in SDK. It just show difference beetwen SDK data and last saved data.
So if in SDK data is 123, show priority-group drop counters will show 0 (123 minus 123) - data is cleared
If in SDK data is bigger than saved 124, or higher show priority-group drop counters will show 1 (124 minus 123)
FIX
After config reload all counters drop counters data retrieved from SDK become cleared. All counters become zeros.
In this case show priority-group drop counters will show -123 ( 0 (from SDK) minus 123 (saved backup))
So we don't need backup after config reload

- How I did it
remove /tmp/dropstat-{user_id} folders with counters backup

Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com>
liat-grozovik pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jul 7, 2021
Updates:
888701b [Mellanox] Remove mstdump from Mellanoxs collect dump script ([sonic-net/sonic-utilities#1706])
4818360 [sonic-package-manager] support warm/fast reboot for extension packages ([sonic-net/sonic-utilities#1554])
793b847 [show priority-group drop counters] Remove backup with cached PG drop counters after 'config reload' ([sonic-net/sonic-utilities#1679])
24fe1ac [show][config] support for interface alias for muxcable commands ([sonic-net/sonic-utilities#1699])
xumia pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jul 9, 2021
Updates:
888701b [Mellanox] Remove mstdump from Mellanoxs collect dump script ([sonic-net/sonic-utilities#1706])
4818360 [sonic-package-manager] support warm/fast reboot for extension packages ([sonic-net/sonic-utilities#1554])
793b847 [show priority-group drop counters] Remove backup with cached PG drop counters after 'config reload' ([sonic-net/sonic-utilities#1679])
24fe1ac [show][config] support for interface alias for muxcable commands ([sonic-net/sonic-utilities#1699])
qiluo-msft pushed a commit to sonic-net/sonic-buildimage that referenced this pull request Jul 14, 2021
Update:
> 2ca493b 2021-07-13 create sniffer folder if not exist (sonic-net/sonic-utilities#1659) 
> 1695104 2021-07-07 [show priority-group drop counters] Remove backup with cached PG drop counters after 'config reload' (sonic-net/sonic-utilities#1679) 
> e99a3c5 2021-07-07 [show][config] support for interface alias for muxcable commands (sonic-net/sonic-utilities#1699)
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
Updates:
888701b [Mellanox] Remove mstdump from Mellanoxs collect dump script ([sonic-net/sonic-utilities#1706])
4818360 [sonic-package-manager] support warm/fast reboot for extension packages ([sonic-net/sonic-utilities#1554])
793b847 [show priority-group drop counters] Remove backup with cached PG drop counters after 'config reload' ([sonic-net/sonic-utilities#1679])
24fe1ac [show][config] support for interface alias for muxcable commands ([sonic-net/sonic-utilities#1699])
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-utilities that referenced this pull request Aug 10, 2021
… counters after 'config reload' (sonic-net#1679)

- What I did
Explanation how show/clear counters works:

Suppose we got from SDK some count of dropped packets for priority group (№3) per interface (Ehernet4). (for example Ethernet4 PG-3 123 packets)
Stats can be shown via show priority-group drop counters
Then we run sonic-clear priority-group drop counters. This command will save data "Ethernet4 PG-3 123 packets" to backup. It saved in /tmp/dropstat-{user_id} folder
When we run show priority-group drop counters again, script will take data from SDK and data saved from backup. In backup it will find 123. In SDK it may still be number 123 for Ethernet4 (like in backup) or bigger (for example 126.)
Our sonic-clear priority-group drop counters command does not change anything in SDK. It just show difference beetwen SDK data and last saved data.
So if in SDK data is 123, show priority-group drop counters will show 0 (123 minus 123) - data is cleared
If in SDK data is bigger than saved 124, or higher show priority-group drop counters will show 1 (124 minus 123)
FIX
After config reload all counters drop counters data retrieved from SDK become cleared. All counters become zeros.
In this case show priority-group drop counters will show -123 ( 0 (from SDK) minus 123 (saved backup))
So we don't need backup after config reload

- How I did it
remove /tmp/dropstat-{user_id} folders with counters backup

Signed-off-by: Andriy Yurkiv <ayurkiv@nvidia.com>
@ayurkiv-nvda ayurkiv-nvda deleted the pg_drop_minus_counters_azure branch May 30, 2023 21:52
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.

4 participants