sonic-swss-common
sonic-swss-common copied to clipboard
ConfigDBPipeConnector_Native_get_config fails if CONFIG_DB_UPDATED string key exists in CONFIG_DB
summary
"CONFIG_DB_UPDATED" string key is inserted in CONFIG_DB after changing settings in RESTCONF. ( https://github.com/Azure/sonic-mgmt-common/blob/master/translib/db/db.go#L1421 ) If this key is present, ConfigDBPipeConnector_Native_get_config fails.
procedure for reproducing
- environment
admin@sonic:~$ show version
SONiC Software Version: SONiC.202012.0-08307385
Distribution: Debian 10.8
Kernel: 4.19.0-12-2-amd64
Build commit: 08307385
Build date: Wed Mar 10 03:10:26 UTC 2021
Built by: tetsuji@kf1-AF13sv001
Platform: x86_64-dellemc_s5248f_c3538-r0
HwSKU: DellEMC-S5248f-P-25G
ASIC: broadcom
ASIC Count: 1
...<snip>
- update config with RESTCONF (it's example)
$ curl -s -X POST -H 'Content-Type:application/yang-data+json' -H 'Accept:application/yang-data+json' --insecure 'https://<sonic ip address>/restconf/data/sonic-interface:sonic-interface/INTERFACE' -d '{"sonic-interface:INTERFACE_LIST": [{"portname": "Ethernet1"}], "sonic-interface:INTERFACE_IPADDR_LIST": [{"portname": "Ethernet1","ip_prefix": "172.30.128.2/31"}]}'
- sonic-cfggen fails in _swsscommon.ConfigDBPipeConnector_Native_get_config(self)
admin@sonic:~$ sonic-cfggen -d
Traceback (most recent call last):
File "/usr/local/bin/sonic-cfggen", line 432, in <module>
main()
File "/usr/local/bin/sonic-cfggen", line 361, in main
deep_update(data, FormatConverter.db_to_output(configdb.get_config()))
File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 2087, in get_config
data = super(ConfigDBConnector, self).get_config()
File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 2117, in get_config
return _swsscommon.ConfigDBPipeConnector_Native_get_config(self)
RuntimeError: Got unexpected result: Input/output error
- DELete string keys "CONFIG_DB_UPDATED_*", then get well
admin@sonic:~$ redis-cli -n 4
127.0.0.1:6379[4]> KEYS CONFIG_*
1) "CONFIG_DB_UPDATED_INTERFACE"
2) "CONFIG_DB_INITIALIZED"
3) "CONFIG_DB_UPDATED"
127.0.0.1:6379[4]> TYPE CONFIG_DB_UPDATED_INTERFACE
string
127.0.0.1:6379[4]> HGETALL CONFIG_DB_UPDATED_INTERFACE
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379[4]> GET CONFIG_DB_UPDATED_INTERFACE
"1"
127.0.0.1:6379[4]> TYPE CONFIG_DB_UPDATED
string
127.0.0.1:6379[4]> HGETALL CONFIG_DB_UPDATED
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379[4]> GET CONFIG_DB_UPDATED
"1"
127.0.0.1:6379[4]> DEL CONFIG_DB_UPDATED_INTERFACE
(integer) 1
127.0.0.1:6379[4]> DEL CONFIG_DB_UPDATED
(integer) 1
127.0.0.1:6379[4]> KEYS CONFIG_*
1) "CONFIG_DB_INITIALIZED"
127.0.0.1:6379[4]> exit
admin@sonic:~$ sonic-cfggen -d --print-data | more
{
"CRM": {
"Config": {
"acl_counter_high_threshold": "85",
...<snip>