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

feat: rudder-server modification to use suppression-backup service. #3116

Merged
merged 22 commits into from
Apr 5, 2023

Conversation

saurav-malani
Copy link
Contributor

@saurav-malani saurav-malani commented Mar 20, 2023

Description

Modified rudder-server suppression component to make use of suppression-backup-service to get latest & complete user suppression list instead of syncing with data-regulation-service. This modification would result is drastically reducing the suppression sync time at gateway.

Here, we make sure that gateway starts once we have the latest users suppressions. Also, we start getting the full suppression list asynchronously in a separate badgerdb repo, since it might take sometime. Once, we have the full list in badgerdb. We simply swap the old badgerdb (with latest users) with the new badgerdb (with all users).

Notion Ticket

https://www.notion.so/rudderstacks/Speed-up-resync-of-suppress-regulations-b29f4df9d10047c7ae3ae7d80781b9bb?pvs=4

@saurav-malani saurav-malani force-pushed the feat.suppressionBackupServerModify branch from b1d81c6 to d7c3daa Compare March 23, 2023 08:12
@saurav-malani saurav-malani changed the title Feat.suppression backup server modify feat: rudder-server modification to use suppression-backup service. Mar 23, 2023
@saurav-malani saurav-malani marked this pull request as ready for review March 23, 2023 08:13
@saurav-malani saurav-malani force-pushed the feat.suppressionBackupServerModify branch from 0e6f795 to e4b0ffb Compare March 30, 2023 05:31
@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Patch coverage: 61.46% and project coverage change: +0.11 🎉

Comparison is base (d7ac3a8) 52.28% compared to head (8bf9f2e) 52.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3116      +/-   ##
==========================================
+ Coverage   52.28%   52.40%   +0.11%     
==========================================
  Files         321      322       +1     
  Lines       52789    52944     +155     
==========================================
+ Hits        27602    27745     +143     
+ Misses      23527    23526       -1     
- Partials     1660     1673      +13     
Impacted Files Coverage Δ
enterprise/suppress-user/repo_switch.go 28.57% <28.57%> (ø)
runner/runner.go 69.88% <42.10%> (ø)
...rprise/suppress-user/internal/badgerdb/badgerdb.go 78.53% <58.82%> (-1.47%) ⬇️
enterprise/suppress-user/factory.go 69.00% <69.12%> (+59.57%) ⬆️
regulation-worker/cmd/main.go 71.95% <100.00%> (ø)

... and 6 files with indirect coverage changes

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/internal/badgerdb/badgerdb.go Outdated Show resolved Hide resolved
enterprise/suppress-user/internal/badgerdb/badgerdb.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
@saurav-malani saurav-malani force-pushed the feat.suppressionBackupServerModify branch from 989c896 to 0ecef29 Compare March 30, 2023 14:01
@saurav-malani saurav-malani marked this pull request as draft March 30, 2023 14:57
@saurav-malani saurav-malani marked this pull request as ready for review March 30, 2023 15:07
@saurav-malani saurav-malani force-pushed the feat.suppressionBackupServerModify branch from ea4c7ba to e934561 Compare March 31, 2023 07:28
enterprise/suppress-user/internal/badgerdb/badgerdb.go Outdated Show resolved Hide resolved
enterprise/suppress-user/internal/badgerdb/badgerdb.go Outdated Show resolved Hide resolved
enterprise/suppress-user/internal/badgerdb/badgerdb.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
@saurav-malani saurav-malani force-pushed the feat.suppressionBackupServerModify branch 2 times, most recently from c9abdb8 to f32f95b Compare April 3, 2023 09:51
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory_test.go Show resolved Hide resolved
enterprise/suppress-user/factory_test.go Outdated Show resolved Hide resolved
enterprise/suppress-user/repo_switch.go Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
enterprise/suppress-user/factory.go Outdated Show resolved Hide resolved
if err == nil {
return
}
m.Log.Errorf("retry failed: %v", err)
Copy link
Collaborator

@fracasula fracasula Apr 4, 2023

Choose a reason for hiding this comment

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

It feels like it would be better to log the error in the anonymous function instead of logging it here. This way we can add some context to the error like:

m.retryIndefinitely(ctx, func() error {
	if _, err = os.Create(filepath.Join(fullSuppressionPath, model.SyncDoneMarker)); err != nil {
		return fmt.Errorf("could not create sync marker: %v", err)
	}
	return nil
}, 1*time.Second)

Also, I'm not sure trying these ops forever without anybody looking at the logs is a good idea.
For example, let's say that it fails forever at the 2nd step (i.e. fullSyncer.Sync(ctx)). How are we going to notice?

cc @atzoum

Copy link
Contributor

Choose a reason for hiding this comment

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

Alerting for sync failures is something we are missing for the whole suppression feature (not just for this scenario). Let's treat alerting in another task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants