Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush RESTAPI db in fast-reboot shutdown path #2917

Merged

Conversation

bingwang-ms
Copy link
Contributor

@bingwang-ms bingwang-ms commented Jul 19, 2023

What I did

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

@@ -791,6 +791,7 @@ for service in ${SERVICES_TO_STOP}; do
sonic-db-cli ASIC_DB FLUSHDB > /dev/null
sonic-db-cli COUNTERS_DB FLUSHDB > /dev/null
sonic-db-cli FLEX_COUNTER_DB FLUSHDB > /dev/null
sonic-db-cli RESTAPI_DB FLUSHDB > /dev/null
Copy link
Contributor

Choose a reason for hiding this comment

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

This will get cleared for NVIDIA's warmboot (fastfast-reboot). I think that is not expected.

Should this check be restricted to fast-reboot? @prsunny ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the code. Now it's limited to fast-reboot only.

@bingwang-ms bingwang-ms marked this pull request as ready for review July 19, 2023 15:36
@bingwang-ms
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 2917 in repo sonic-net/sonic-utilities

@jarias-lfx
Copy link

/easycla

1 similar comment
@bingwang-ms
Copy link
Contributor Author

/easycla

@bingwang-ms bingwang-ms merged commit 489a0c9 into sonic-net:master Jul 19, 2023
@bingwang-ms
Copy link
Contributor Author

@bingwang-ms
Copy link
Contributor Author

PR filed for 202205 branch #2921

rajkumar38 pushed a commit to rajkumar38/sonic-utilities that referenced this pull request Jul 25, 2023
* Flush RESTAPI db in fast-reboot shutdown path
StormLiangMS pushed a commit that referenced this pull request Aug 6, 2023
* Flush RESTAPI db in fast-reboot shutdown path
pdhruv-marvell pushed a commit to pdhruv-marvell/sonic-utilities that referenced this pull request Aug 23, 2023
* Flush RESTAPI db in fast-reboot shutdown path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants