Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions files/scripts/swss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,20 @@ start() {
$SONIC_DB_CLI RESTAPI_DB FLUSHDB
clean_up_tables STATE_DB "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*', 'FG_ROUTE_TABLE*', 'BUFFER_POOL*', 'BUFFER_PROFILE*', 'MUX_CABLE_TABLE*', 'ADVERTISE_NETWORK_TABLE*', 'VXLAN_TUNNEL_TABLE*', 'VNET_ROUTE*', 'MACSEC_PORT_TABLE*', 'MACSEC_INGRESS_SA_TABLE*', 'MACSEC_EGRESS_SA_TABLE*', 'MACSEC_INGRESS_SC_TABLE*', 'MACSEC_EGRESS_SC_TABLE*', 'VRF_OBJECT_TABLE*', 'VNET_MONITOR_TABLE*', 'BFD_SESSION_TABLE*', 'SYSTEM_NEIGH_TABLE*', 'FABRIC_PORT_TABLE*', 'TUNNEL_DECAP_TABLE*', 'TUNNEL_DECAP_TERM_TABLE*', 'HIGH_FREQUENCY_TELEMETRY_SESSION_TABLE*' "
$SONIC_DB_CLI APPL_STATE_DB FLUSHDB
# Flush DPU remote databases (DPU device only)
# Only run if this is a DPU device (type=SmartSwitchDPU or switch_type=dpu)
DEVICE_TYPE=`$SONIC_DB_CLI CONFIG_DB hget "DEVICE_METADATA|localhost" type`
SWITCH_TYPE=`$SONIC_DB_CLI CONFIG_DB hget "DEVICE_METADATA|localhost" switch_type`
if [[ x"${DEVICE_TYPE}" == x"SmartSwitchDPU" || x"${SWITCH_TYPE}" == x"dpu" ]]; then
# Check if DPU_APPL_DB remote database is reachable
if $SONIC_DB_CLI DPU_APPL_DB PING >/dev/null 2>&1; then
debug "Flushing DPU remote databases (DPU_APPL_DB, DPU_STATE_DB, DPU_APPL_STATE_DB, DPU_COUNTERS_DB) ..."
$SONIC_DB_CLI DPU_APPL_DB FLUSHDB
$SONIC_DB_CLI DPU_STATE_DB FLUSHDB
$SONIC_DB_CLI DPU_APPL_STATE_DB FLUSHDB
$SONIC_DB_CLI DPU_COUNTERS_DB FLUSHDB
Comment on lines +419 to +422
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DPU DB flushes are performed without checking the return code. Since these can target the remote_redis instance, a transient connectivity issue could leave stale entries behind without any clear indication of which FLUSHDB failed. Consider checking each FLUSHDB command’s exit status and logging failures (or failing fast) to make swss restart behavior deterministic and debuggable.

Suggested change
$SONIC_DB_CLI DPU_APPL_DB FLUSHDB
$SONIC_DB_CLI DPU_STATE_DB FLUSHDB
$SONIC_DB_CLI DPU_APPL_STATE_DB FLUSHDB
$SONIC_DB_CLI DPU_COUNTERS_DB FLUSHDB
if ! $SONIC_DB_CLI DPU_APPL_DB FLUSHDB; then
debug "Failed to flush DPU_APPL_DB via FLUSHDB"
exit 1
fi
if ! $SONIC_DB_CLI DPU_STATE_DB FLUSHDB; then
debug "Failed to flush DPU_STATE_DB via FLUSHDB"
exit 1
fi
if ! $SONIC_DB_CLI DPU_APPL_STATE_DB FLUSHDB; then
debug "Failed to flush DPU_APPL_STATE_DB via FLUSHDB"
exit 1
fi
if ! $SONIC_DB_CLI DPU_COUNTERS_DB FLUSHDB; then
debug "Failed to flush DPU_COUNTERS_DB via FLUSHDB"
exit 1
fi

Copilot uses AI. Check for mistakes.
fi
fi
clean_up_chassis_db_tables
rm -rf /tmp/cache
MEDIA_SETTINGS="/usr/share/sonic/device/$PLATFORM/media_settings.json"
Expand Down
Loading