Skip to content

Commit

Permalink
Backup STATE_DB PORT_TABLE|Ethernet during warm-reboot (sonic-net#3111)
Browse files Browse the repository at this point in the history
* Backup STATE_DB PORT_TABLE during warm-reboot

Signed-off-by: Mihir Patel <[email protected]>

* Backing up selected fields from STATE_DB PORT_TABLE|Ethernet* and deleting unwanted fields during warm-reboot

---------

Signed-off-by: Mihir Patel <[email protected]>
  • Loading branch information
mihirpat1 authored and mssonicbld committed Jun 3, 2024
1 parent ce699c4 commit b72be1d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/fast-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,17 @@ function backup_database()
# Delete keys in stateDB except FDB_TABLE|*, MIRROR_SESSION_TABLE|*, WARM_RESTART_ENABLE_TABLE|*, FG_ROUTE_TABLE|*
sonic-db-cli STATE_DB eval "
for _, k in ipairs(redis.call('keys', '*')) do
if not string.match(k, 'FDB_TABLE|') and not string.match(k, 'WARM_RESTART_TABLE|') \
if string.match(k, 'PORT_TABLE|Ethernet') then
for i, f in ipairs(redis.call('hgetall', k)) do
if i % 2 == 1 then
if not string.match(f, 'host_tx_ready') \
and not string.match(f, 'NPU_SI_SETTINGS_SYNC_STATUS') \
and not string.match(f, 'CMIS_REINIT_REQUIRED') then
redis.call('hdel', k, f)
end
end
end
elseif not string.match(k, 'FDB_TABLE|') and not string.match(k, 'WARM_RESTART_TABLE|') \
and not string.match(k, 'MIRROR_SESSION_TABLE|') \
and not string.match(k, 'FG_ROUTE_TABLE|') \
and not string.match(k, 'WARM_RESTART_ENABLE_TABLE|') \
Expand Down

0 comments on commit b72be1d

Please sign in to comment.