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

Avoid kvset/kvget race on subscriptions update #348

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

lieut-data
Copy link
Member

Summary

When adding or deleting a subscription, we save the subscriptions via KVSet, and previously turned around to fetch those with KVGet before broadcasting to the client. On installations with a database replica, the second request might not hit the master database, and the update just effected might not be "seen".

Skip the KVGet and instead just use the information about the updated susbcriptions that we already have in hand when updating the client.

Ticket Link

Fixes: #342

When adding or deleting a subscription, we save the subscriptions via `KVSet`, and previously turned around to fetch those with `KVGet` before broadcasting to the client. On installations with a database replica, the second request might not hit the `master` database, and the update just effected might not be "seen".

Skip the `KVGet` and instead just use the information about the updated susbcriptions that we already have in hand when updating the client.

Fixes: #342
@lieut-data lieut-data added the 2: Dev Review Requires review by a core committer label Dec 15, 2022
@codecov
Copy link

codecov bot commented Dec 15, 2022

Codecov Report

Base: 32.00% // Head: 32.45% // Increases project coverage by +0.45% 🎉

Coverage data is based on head (6676300) compared to base (57e74ce).
Patch coverage: 70.37% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #348      +/-   ##
==========================================
+ Coverage   32.00%   32.45%   +0.45%     
==========================================
  Files          21       21              
  Lines        3390     3389       -1     
==========================================
+ Hits         1085     1100      +15     
+ Misses       2196     2182      -14     
+ Partials      109      107       -2     
Impacted Files Coverage Δ
server/command.go 24.05% <40.00%> (+0.13%) ⬆️
server/subscriptions.go 55.81% <75.00%> (+8.61%) ⬆️
server/plugin.go 15.73% <100.00%> (+0.43%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@hanzei hanzei added this to the v1.6.0 milestone Jan 2, 2023
@lieut-data lieut-data added the 4: Reviews Complete All reviewers have approved the pull request label Jan 10, 2023
@hanzei hanzei added 3: QA Review Requires review by a QA tester and removed 2: Dev Review Requires review by a core committer labels Jan 10, 2023
@hanzei
Copy link
Collaborator

hanzei commented Jan 10, 2023

@DHaussermann The PR is ready for your review

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed

  • Found an affected server and upgraded to ensure the issue is resolved
  • Delete command is always reflected in the RHS in real-time
  • Tested on in HA as well
    No issues found

LGTM!

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request QA Review Done PR has been approved by QA and removed 4: Reviews Complete All reviewers have approved the pull request 3: QA Review Requires review by a QA tester labels Jan 10, 2023
@lieut-data lieut-data merged commit 8106e4a into master Jan 10, 2023
@lieut-data lieut-data deleted the issue-342-avoid-subs-race branch January 10, 2023 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request QA Review Done PR has been approved by QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent issue where subscription deletes don't reflect on RHS in real time.
5 participants