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

TT-6968 GroupLogin synchronization force #4605

Merged
merged 8 commits into from Jan 3, 2023
Merged

Conversation

tbuchaillot
Copy link
Contributor

@tbuchaillot tbuchaillot commented Dec 30, 2022

[changelog]
fixed: force synchronization for the edge group when slave_options.synchroniser_enabled is set to true.

Description

This PR adds a new groupLogin callback function for RPC connections when slave_options.synchroniser_enabled=true. This changes the groupLogin function, adding an extra param to force the group synchronization in MDCB.
It also adds a sync group key in Redis for the group to avoid multiple synchronizations force.

This is complementary to the work done in https://github.com/TykTechnologies/tyk-sink/pull/307

Related Issue

https://tyktech.atlassian.net/browse/TT-6968

Motivation and Context

https://tyktech.atlassian.net/browse/TT-6968

How This Has Been Tested

Added unit tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring or add test (improvements in base code or adds test coverage to functionality)

Checklist

  • I ensured that the documentation is up to date
  • I explained why this PR updates go.mod in detail with reasoning why it's required
  • I would like a code coverage CI quality gate exception and have explained why

@Tyk-ITS
Copy link
Contributor

Tyk-ITS commented Dec 30, 2022

API tests result: success
Branch used: refs/pull/4605/merge
Commit: ea0dcca
Triggered by: pull_request (@tbuchaillot)
Execution page

@tbuchaillot tbuchaillot changed the title TT-6968 TT-6968 GroupLogin synchronization force Dec 30, 2022
@TykTechnologies TykTechnologies deleted a comment from github-actions bot Dec 30, 2022
@TykTechnologies TykTechnologies deleted a comment from Tyk-ITS Dec 30, 2022
@TykTechnologies TykTechnologies deleted a comment from Tyk-ITS Dec 30, 2022
@TykTechnologies TykTechnologies deleted a comment from github-actions bot Dec 30, 2022
@TykTechnologies TykTechnologies deleted a comment from github-actions bot Dec 30, 2022
@Tyk-ITS
Copy link
Contributor

Tyk-ITS commented Dec 30, 2022

API tests result: success
Branch used: refs/pull/4605/merge
Commit: c197a65
Triggered by: pull_request (@tbuchaillot)
Execution page

@TykTechnologies TykTechnologies deleted a comment from sonarcloud bot Dec 30, 2022
@tbuchaillot tbuchaillot enabled auto-merge (squash) December 30, 2022 22:08
@tbuchaillot tbuchaillot enabled auto-merge (squash) December 30, 2022 22:08
@Tyk-ITS
Copy link
Contributor

Tyk-ITS commented Dec 30, 2022

API tests result: success
Branch used: refs/pull/4605/merge
Commit: 680de0c
Triggered by: pull_request (@tbuchaillot)
Execution page

Copy link
Contributor

@sredxny sredxny left a comment

Choose a reason for hiding this comment

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

Added some comments, requested some information. Also, lets manually test with older versions od MDCB to check compatibility

rpc/synchronization_forcer.go Outdated Show resolved Hide resolved
Comment on lines +14 to +21
func NewSyncForcer(redisController *storage.RedisController) *SyncronizerForcer {
sf := &SyncronizerForcer{}

sf.store = &storage.RedisCluster{KeyPrefix: "synchronizer-group-", RedisController: redisController}
sf.store.Connect()

return sf
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why do we need a separate object and functions to force a synchronization? is not enough only sending the param to MDCB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sredxny the force param is going to change depending if the key exists or not in the Redis.
The RPC Connect function receives a function getGroupLoginFunc so I thought having a separated structure with its own groupLoginCallback it's the cleanest way to do it, without modifying the current behavior since this new callback func is only going to work when the synchronizer is enabled (slave_options.synchroniser_enabled).

Does it makes sense?

Copy link
Contributor

@mativm02 mativm02 left a comment

Choose a reason for hiding this comment

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

lgtm!

@sonarcloud
Copy link

sonarcloud bot commented Jan 3, 2023

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

92.0% 92.0% Coverage
0.0% 0.0% Duplication

@Tyk-ITS
Copy link
Contributor

Tyk-ITS commented Jan 3, 2023

API tests result: success
Branch used: refs/pull/4605/merge
Commit: c374351
Triggered by: pull_request (@tbuchaillot)
Execution page

@Tyk-ITS
Copy link
Contributor

Tyk-ITS commented Jan 3, 2023

API tests result: success
Branch used: refs/pull/4605/merge
Commit: 08479fd
Triggered by: pull_request (@tbuchaillot)
Execution page

@tbuchaillot
Copy link
Contributor Author

Added some comments, requested some information. Also, lets manually test with older versions od MDCB to check compatibility

I manually tested it with MDCB v2.0.3 and everything was working as expected.

Copy link
Contributor

@sredxny sredxny left a comment

Choose a reason for hiding this comment

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

lgtm

@tbuchaillot tbuchaillot merged commit 178511b into master Jan 3, 2023
@tbuchaillot tbuchaillot deleted the bugfix/TT-6968 branch January 3, 2023 19:08
@tbuchaillot
Copy link
Contributor Author

/release to release-4

@tykbot
Copy link

tykbot bot commented Jan 3, 2023

Working on it! Note that it can take a few minutes.

tykbot bot pushed a commit that referenced this pull request Jan 3, 2023
[changelog]
fixed: force synchronization for the edge group when `slave_options.synchroniser_enabled` is set to true.

(cherry picked from commit 178511b)
@tykbot
Copy link

tykbot bot commented Jan 3, 2023

@tbuchaillot Succesfully merged PR

@tbuchaillot
Copy link
Contributor Author

/release to release-4.3

@tykbot
Copy link

tykbot bot commented Jan 3, 2023

Working on it! Note that it can take a few minutes.

tykbot bot pushed a commit that referenced this pull request Jan 3, 2023
[changelog]
fixed: force synchronization for the edge group when `slave_options.synchroniser_enabled` is set to true.

(cherry picked from commit 178511b)
@tykbot
Copy link

tykbot bot commented Jan 3, 2023

@tbuchaillot Succesfully merged PR

tbuchaillot added a commit that referenced this pull request Jan 3, 2023
…) (#4610)

TT-6968 GroupLogin synchronization force (#4605)

[changelog]
fixed: force synchronization for the edge group when
`slave_options.synchroniser_enabled` is set to true.

Co-authored-by: Tomas Buchaillot <tombuchaillot89@gmail.com>
tbuchaillot added a commit that referenced this pull request Jan 3, 2023
#4609)

TT-6968 GroupLogin synchronization force (#4605)

[changelog]
fixed: force synchronization for the edge group when
`slave_options.synchroniser_enabled` is set to true.

Co-authored-by: Tomas Buchaillot <tombuchaillot89@gmail.com>
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.

None yet

4 participants