Skip to content

[202205] Flush RESTAPI db in fast-reboot shutdown path#2921

Merged
yxieca merged 2 commits intosonic-net:202205from
bingwang-ms:flush_restapi_db_in_fast_reboot_202205
Jul 20, 2023
Merged

[202205] Flush RESTAPI db in fast-reboot shutdown path#2921
yxieca merged 2 commits intosonic-net:202205from
bingwang-ms:flush_restapi_db_in_fast_reboot_202205

Conversation

@bingwang-ms
Copy link
Copy Markdown
Contributor

What I did

This PR is to backport change #2917 into 202205 branch.

The PR is to flush RESTAPI_DB in the fast-reboot shutdown path.
After PR #2365, the table is not cleared because the WARM_RESTART_ENABLE_TABLE|system is set to true.
So below code in swss.sh doesn't do the db flush.
https://github.com/sonic-net/sonic-buildimage/blob/bdef73ea963064cdc9fbebb63ac381440c0fafd6/files/scripts/swss.sh#L168C1-L181C7

if [[ x"$WARM_BOOT" != x"true" ]]; then
        debug "Flushing APP, ASIC, COUNTER, CONFIG, and partial STATE databases ..."
        $SONIC_DB_CLI APPL_DB FLUSHDB
        $SONIC_DB_CLI ASIC_DB FLUSHDB
        $SONIC_DB_CLI COUNTERS_DB FLUSHDB
        $SONIC_DB_CLI FLEX_COUNTER_DB FLUSHDB
        $SONIC_DB_CLI GB_ASIC_DB FLUSHDB
        $SONIC_DB_CLI GB_COUNTERS_DB FLUSHDB
        $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*'"
        $SONIC_DB_CLI APPL_STATE_DB FLUSHDB
        rm -rf /tmp/cache
    fi

How I did it

Flush RESTAPI_DB in the fast-reboot shutdown path.

How to verify it

We have a sonic-mgmt test case restapi/test_restapi.py::test_check_reset_status to cover the feature.
The test can pass after this change.

Previous command output (if the output of a command-line utility has changed)

N/A

New command output (if the output of a command-line utility has changed)

N/A

@yxieca yxieca merged commit 0c6d0c5 into sonic-net:202205 Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants