@@ -31,8 +31,8 @@ function unlock_service_state_change()
31
31
32
32
function check_warm_boot()
33
33
{
34
- SYSTEM_WARM_START=` /usr/bin/redis- cli -n 6 hget " WARM_RESTART_ENABLE_TABLE|system" enable`
35
- SERVICE_WARM_START=` /usr/bin/redis- cli -n 6 hget " WARM_RESTART_ENABLE_TABLE|${SERVICE} " enable`
34
+ SYSTEM_WARM_START=` sonic-db- cli STATE_DB hget " WARM_RESTART_ENABLE_TABLE|system" enable`
35
+ SERVICE_WARM_START=` sonic-db- cli STATE_DB hget " WARM_RESTART_ENABLE_TABLE|${SERVICE} " enable`
36
36
if [[ x" $SYSTEM_WARM_START " == x" true" ]] || [[ x" $SERVICE_WARM_START " == x" true" ]]; then
37
37
WARM_BOOT=" true"
38
38
else
@@ -43,7 +43,7 @@ function check_warm_boot()
43
43
function validate_restore_count()
44
44
{
45
45
if [[ x" $WARM_BOOT " == x" true" ]]; then
46
- RESTORE_COUNT=` /usr/bin/redis- cli -n 6 hget " WARM_RESTART_TABLE|orchagent" restore_count`
46
+ RESTORE_COUNT=` sonic-db- cli STATE_DB hget " WARM_RESTART_TABLE|orchagent" restore_count`
47
47
# We have to make sure db data has not been flushed.
48
48
if [[ -z " $RESTORE_COUNT " ]]; then
49
49
WARM_BOOT=" false"
@@ -54,12 +54,10 @@ function validate_restore_count()
54
54
function wait_for_database_service()
55
55
{
56
56
# Wait for redis server start before database clean
57
- until [[ $( /usr/bin/docker exec database redis-cli ping | grep -c PONG) -gt 0 ]];
58
- do sleep 1;
59
- done
57
+ /usr/bin/docker exec database ping_pong_db_insts
60
58
61
59
# Wait for configDB initialization
62
- until [[ $( /usr/bin/docker exec database redis- cli -n 4 GET " CONFIG_DB_INITIALIZED" ) ]];
60
+ until [[ $( sonic-db- cli CONFIG_DB GET " CONFIG_DB_INITIALIZED" ) ]];
63
61
do sleep 1;
64
62
done
65
63
}
@@ -69,7 +67,7 @@ function wait_for_database_service()
69
67
# $2 the string of a list of table prefixes
70
68
function clean_up_tables()
71
69
{
72
- redis-cli -n $1 EVAL "
70
+ sonic-db-cli $1 EVAL "
73
71
local tables = {$2 }
74
72
for i = 1, table.getn(tables) do
75
73
local matches = redis.call('KEYS', tables[i])
@@ -114,11 +112,11 @@ start() {
114
112
# Don't flush DB during warm boot
115
113
if [[ x" $WARM_BOOT " != x" true" ]]; then
116
114
debug " Flushing APP, ASIC, COUNTER, CONFIG, and partial STATE databases ..."
117
- /usr/bin/docker exec database redis- cli -n 0 FLUSHDB
118
- /usr/bin/docker exec database redis- cli -n 1 FLUSHDB
119
- /usr/bin/docker exec database redis- cli -n 2 FLUSHDB
120
- /usr/bin/docker exec database redis- cli -n 5 FLUSHDB
121
- clean_up_tables 6 " 'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'LAG_TABLE*', 'LAG_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*', 'VRF_TABLE*', 'FDB_TABLE*'"
115
+ sonic-db- cli APPL_DB FLUSHDB
116
+ sonic-db- cli ASIC_DB FLUSHDB
117
+ sonic-db- cli COUNTERS_DB FLUSHDB
118
+ sonic-db- cli FLEX_COUNTER_DB FLUSHDB
119
+ 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*'"
122
120
fi
123
121
124
122
# start service docker
@@ -166,7 +164,7 @@ stop() {
166
164
# encountered error, e.g. syncd crashed. And swss needs to
167
165
# be restarted.
168
166
debug " Clearing FAST_REBOOT flag..."
169
- clean_up_tables 6 " 'FAST_REBOOT*'"
167
+ clean_up_tables STATE_DB " 'FAST_REBOOT*'"
170
168
171
169
# Unlock has to happen before reaching out to peer service
172
170
unlock_service_state_change
0 commit comments