Skip to content

Commit

Permalink
Fix State Db LAG_MEMBER_TABLE removal not happening. (#3347)
Browse files Browse the repository at this point in the history
What I did:
Original issue and and PR: #3333

Why I did:
Fix the failure in test_po_update.py as seen in this PR checker: sonic-net/sonic-buildimage#20610
Previous fix blocked State Db LAG_MEMBER_TABLE deletion which is not correct as this table is created by tlm_teamd (owner).
Intention was to prevent deletion of State Db LAG_TABLE owner of which is teamsyncd.
  • Loading branch information
abdosi authored and mssonicbld committed Oct 30, 2024
1 parent e54c2b7 commit ce81011
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tlm_teamd/values_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ void ValuesStore::remove_keys_db(const std::vector<std::string> & keys)
const auto & p = split_key(key);
const auto & table_name = p.first;
const auto & table_key = p.second;
// Do not delete te key from State Db for table LAB_TABLE. LAB_TABLE entry is created/deleted
// from teamsyncd on detecting netlink of teamd dev as up/down. For some reason
// if we do not get state dump from teamdctl it might be transient issue. If it is
// persistent issue then teamsyncd might be able to catch it and delete state db entry
// or we can keep entry in it's current state as best effort. Similar to try_add_lag which is best effort
// to connect to teamdctl and if it fails we do not delete State Db entry.
if (table_name == "LAG_TABLE")
continue;
swss::Table table(m_db, table_name);
table.del(table_key);
}
Expand Down Expand Up @@ -366,13 +374,7 @@ void ValuesStore::update(const std::vector<StringPair> & dumps)
{
const auto & storage = from_json(dumps);
const auto & old_keys = get_old_keys(storage);
// Do not delete te key from State Db. State DB LAB_TABLE entry is created/deleted
// from teamsyncd on detecting netlink of teamd dev as up/down. For some reason
// if we do not get state dump from teamdctl it might be transient issue. If it is
// persistent issue then teamsyncd might be able to catch it and delete state db entry
// or we can keep entry in it's current state as best effort. Similar to try_add_lag which is best effort
// to connect to teamdctl and if it fails we do not delete State Db entry.
//remove_keys_db(old_keys);
remove_keys_db(old_keys);
remove_keys_storage(old_keys);
const auto & keys_to_refresh = update_storage(storage);
update_db(storage, keys_to_refresh);
Expand Down

0 comments on commit ce81011

Please sign in to comment.