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

[configdb] fix bug of leaving unwanted columns in a hash #23

Merged
merged 1 commit into from
Dec 5, 2017

Conversation

ishidawataru
Copy link
Contributor

@ishidawataru ishidawataru commented Nov 17, 2017

Current implementation doesn't remove unwanted columes with set_entry
like below.

>>> set_entry('table', 'key', {'key1': 'value1', 'key2': 'value2'})
>>> set_entry('table', 'key', {'key1': 'value3'})
>>> get_entry('table', 'key')
{'key1': 'value3', 'key2': 'value2'}

This commit fix this bug.

Signed-off-by: Wataru Ishida ishida.wataru@lab.ntt.co.jp

Current implementation doesn't remove unwanted columes with set_entry
like below.

>>> set_entry('table', 'key', {'key1': 'value1', 'key2': 'value2'})
>>> set_entry('table', 'key', {'key1': 'value3'})
>>> get_entry('table', 'key')
{'key1': 'value3', 'key2': 'value2'}

This commit fix this bug.

Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
@ishidawataru
Copy link
Contributor Author

I found #15 solves the same issue in a different way.

#15 is more lightweight but needs to explicitly specify the keys for removal.
The fix I made doesn't need to specify the keys for removal but needs to retrieve the original data.

@stcheng
Copy link
Contributor

stcheng commented Nov 29, 2017

@taoyl-ms please check.
I don't think this is a bug. When we try to set an attribute with a new value, the current design is that we don't need to provide the rest of the attributes to replace the whole key-value tuple. The #15 will be enough for removing unwanted key-value tuples. However, I think there is a need to add the remove/del function to del an attribute-value tuple.
The logic here shall be similar to the concepts in SAI.

@lguohan
Copy link
Contributor

lguohan commented Dec 5, 2017

set api usually does @ishidawataru says, we need to add a mod_entry API to explicit modify the field.

@lguohan lguohan merged commit b7861cc into sonic-net:master Dec 5, 2017
@ishidawataru ishidawataru deleted the fix-configdb branch December 5, 2017 14:27
praveen-li pushed a commit to praveen-li/sonic-py-swsssdk that referenced this pull request May 4, 2021
* msft_github/master:
  [configdb]: Addopt get_table method to work with python3. (sonic-net#26)
  [configdb]: add mod_entry, rename set_config to mod_config (sonic-net#25)
  [configdb] fix bug of leaving unwanted columns in a hash (sonic-net#23)
  Revert "Add support to remove the key of table entry (sonic-net#15)" (sonic-net#24)
  Add support to remove the key of table entry (sonic-net#15)
  [configdb] support redis connecting methods other than TCP (sonic-net#22)
  [interface]: Extend the max data wait time to 60s (sonic-net#21)
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.

3 participants