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

fix(data): add codes to remove db index of reading:deviceName:resourceName when deleting readings #3775

Merged
merged 1 commit into from
Oct 25, 2021

Conversation

judehung
Copy link
Member

When adding readings, a redis sorted set will be created as db index for
the relation of reading:deviceName:resourceName, and this index will be
used to query readings by deviceName and resourceName.

However, the current implementation doesn't remove such index when an
associated event is deleted, thus generating incorrect query result for
readings.

This commit fixes this bug by adding codes to remove db index of
reading:deviceName:resourceName while deleting readings.

closes #3774

Signed-off-by: Jude Hung [email protected]

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?) The verification will need to run up a redis instance, and our unit tests framework doesn't have such capability at this moment.
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?) No doc changes needed as this is a bug fix.

Testing Instructions

Follow the reproduction steps as described in #3774, the totalCount should be correct.

New Dependency Instructions (If applicable)

…eName when deleting readings

When adding readings, a redis sorted set will be created as db index for
the relation of reading:deviceName:resourceName, and this index will be
used to query readings by deviceName and resourceName.

However, the current implementation doesn't remove such index when an
associated event is deleted, thus generating incorrect query result for
readings.

This commit fixes this bug by adding codes to remove db index of
reading:deviceName:resourceName while deleting readings.

closes edgexfoundry#3774

Signed-off-by: Jude Hung <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@judehung judehung marked this pull request as ready for review October 25, 2021 09:44
Copy link
Member

@cloudxxx8 cloudxxx8 left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

Codecov Report

Merging #3775 (173b095) into main (d840d96) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3775      +/-   ##
==========================================
- Coverage   45.99%   45.99%   -0.01%     
==========================================
  Files         112      112              
  Lines        9583     9584       +1     
==========================================
  Hits         4408     4408              
- Misses       4794     4795       +1     
  Partials      381      381              
Impacted Files Coverage Δ
internal/pkg/infrastructure/redis/reading.go 10.43% <0.00%> (-0.06%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d840d96...173b095. Read the comment docs.

@cloudxxx8 cloudxxx8 merged commit 2960906 into edgexfoundry:main Oct 25, 2021
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.

Query reading by device name and resource name API returned incorrect totalCount value
3 participants