Skip to content

Commit 9841215

Browse files
mihirpat1CharlieChenEC
authored andcommitted
Backup STATE_DB PORT_TABLE|Ethernet during warm-reboot (#3111)
* 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]>
1 parent c4e51f8 commit 9841215

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/fast-reboot

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,17 @@ function backup_database()
247247
# Delete keys in stateDB except FDB_TABLE|*, MIRROR_SESSION_TABLE|*, WARM_RESTART_ENABLE_TABLE|*, FG_ROUTE_TABLE|*
248248
sonic-db-cli STATE_DB eval "
249249
for _, k in ipairs(redis.call('keys', '*')) do
250-
if not string.match(k, 'FDB_TABLE|') and not string.match(k, 'WARM_RESTART_TABLE|') \
250+
if string.match(k, 'PORT_TABLE|Ethernet') then
251+
for i, f in ipairs(redis.call('hgetall', k)) do
252+
if i % 2 == 1 then
253+
if not string.match(f, 'host_tx_ready') \
254+
and not string.match(f, 'NPU_SI_SETTINGS_SYNC_STATUS') \
255+
and not string.match(f, 'CMIS_REINIT_REQUIRED') then
256+
redis.call('hdel', k, f)
257+
end
258+
end
259+
end
260+
elseif not string.match(k, 'FDB_TABLE|') and not string.match(k, 'WARM_RESTART_TABLE|') \
251261
and not string.match(k, 'MIRROR_SESSION_TABLE|') \
252262
and not string.match(k, 'FG_ROUTE_TABLE|') \
253263
and not string.match(k, 'WARM_RESTART_ENABLE_TABLE|') \

0 commit comments

Comments
 (0)