Skip to content

Add cache for local chassis table#75

Merged
qiluo-msft merged 1 commit into
sonic-net:masterfrom
gpunathilell:fix_cache
Nov 17, 2025
Merged

Add cache for local chassis table#75
qiluo-msft merged 1 commit into
sonic-net:masterfrom
gpunathilell:fix_cache

Conversation

@gpunathilell
Copy link
Copy Markdown
Contributor

@gpunathilell gpunathilell commented Oct 20, 2025

Previously Every sync cycle (every 10 seconds by default) would unconditionally:
Delete the LLDP_LOC_CHASSIS table from Redis
Write all chassis attributes back to Redis for the LLDP_LOC_CHASSIS table,
This leads to race conditions, since there is a possibility to perform an snmp query at the same time leading to missing data:
2025 Oct 19 00:41:14.530572 sonic WARNING snmp#snmp-subagent [sonic_ax_impl] WARNING: Missing lldp_loc_man_addr from APPL DB
The change which is done compares new chassis data with the cached version
Only performs DB operations (delete + set) if data has actually changed
Skips all DB writes when chassis data is unchanged

Unit test:

tests/test_lldpSyncDaemon.py::TestLldpSyncDaemon::test_chassis_cache_no_db_calls_when_unchanged PASSED [ 21%]

Required for 202505 branch

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@gpunathilell gpunathilell changed the title Add chassis cache update for Add cache for local chassis table Oct 20, 2025
@dgsudharsan
Copy link
Copy Markdown

@ZhaohuiS Can you please review?

@gpunathilell gpunathilell marked this pull request as ready for review October 21, 2025 06:09
@gpunathilell
Copy link
Copy Markdown
Contributor Author

PR is required for 202505 branch as well

@keboliu
Copy link
Copy Markdown

keboliu commented Oct 22, 2025

@ZhaohuiS would you please help to label this PR as "Request for 202505 branch"?

@ZhaohuiS
Copy link
Copy Markdown
Contributor

@keboliu is it a must fix for 202505? As the description said, there is a rare condition to trigger it.
I suggest not merge it to 202505, since 202511 is coming soon.

@yejianquan for vis.

@keboliu
Copy link
Copy Markdown

keboliu commented Oct 22, 2025

@keboliu is it a must fix for 202505? As the description said, there is a rare condition to trigger it. I suggest not merge it to 202505, since 202511 is coming soon.

@yejianquan for vis.

Hi @ZhaohuiS, we observed test case failure(https://github.com/sonic-net/sonic-mgmt/blob/master/tests/snmp/test_snmp_lldp.py) in our daily regression while qualifying the 202505 branch, and identified this issue. This is why I asked for cherry-picking.

@ZhaohuiS
Copy link
Copy Markdown
Contributor

interesting, normally, the chassis info is not changed after system boots up. how did you hit this failure?
This is our results for the past 30 days on 202505.

image

The only failure is not related to chassis info.

@gpunathilell
Copy link
Copy Markdown
Contributor Author

interesting, normally, the chassis info is not changed after system boots up. how did you hit this failure? This is our results for the past 30 days on 202505.

image The only failure is not related to chassis info.

@ZhaohuiS we observed the test failure only once and it was not reproducible, Chassis info is not changed, but the sync function is called every 10 seconds which means there is data deletion and addition every 10 seconds, which is not necessary if there is no change to the data, which is why the cache is used

@gpunathilell
Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld
Copy link
Copy Markdown

/AzurePipelines run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@dgsudharsan
Copy link
Copy Markdown

@ZhaohuiS Can we merge this?

@ZhaohuiS
Copy link
Copy Markdown
Contributor

I don't have permission to merge.
@StormLiangMS @qiluo-msft could you pls help?

@bingwang-ms
Copy link
Copy Markdown

@StormLiangMS Can you please help check & merge?

@qiluo-msft qiluo-msft merged commit 2f0af22 into sonic-net:master Nov 17, 2025
5 checks passed
@mssonicbld
Copy link
Copy Markdown

Cherry-pick PR to 202511: #77

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.

8 participants