From fcb6c9de918d93967440b78bf7d5cd3a51bf7129 Mon Sep 17 00:00:00 2001 From: bingwang-ms <66248323+bingwang-ms@users.noreply.github.com> Date: Wed, 18 Nov 2020 11:29:12 +0800 Subject: [PATCH] Add a check for warm-restart, and do a clear only when warm-restart is enable. (#1498) This commit is to address the issue that the NEIGH_TABLE loaded by swssconfig after fast-reboot is cleared by neighsyncd. **What I did** Fix https://github.com/Azure/sonic-buildimage/issues/5841 and https://github.com/Azure/sonic-buildimage/issues/5580 We found that neighbor table loaded by ```swssconfig``` from ```arp.json``` after ```fast-reboot``` is cleared by ```neighsyncd``` mistakenly at the initial stage. This PR adds a check for ```WarmStart``` before cleaning up, and only do that if ```WarmStart``` is enable. **Why I did it** This PR is to fix the issue that arp table is not recovered after fast-reboot. **How I verified it** Verified on Arista-7260, running 201911 image. 1. Run some test to populate ARP entries on DUT, such as ```test_fast_reboot``` 2. Issue a fast-reboot 3. Verify the ```arp.json``` backed up by ```fast-reboot-dump.py``` is loaded and NEIGH_TABLE is restored. --- warmrestart/warmRestartAssist.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/warmrestart/warmRestartAssist.cpp b/warmrestart/warmRestartAssist.cpp index 2a02e5ec95af..ca193985770e 100644 --- a/warmrestart/warmRestartAssist.cpp +++ b/warmrestart/warmRestartAssist.cpp @@ -79,7 +79,10 @@ void AppRestartAssist::registerAppTable(const std::string &tableName, ProducerSt m_psTables[tableName] = psTable; // Clear the producerstate table to make sure no pending data for the AppTable - psTable->clear(); + if (m_warmStartInProgress) + { + psTable->clear(); + } m_appTables[tableName] = new Table(m_pipeLine, tableName, false); } @@ -150,7 +153,7 @@ void AppRestartAssist::readTablesToMap() } return; } - + /* * Check and insert to CacheMap Logic: * if delete_key: