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

Attention: Patch coverage is 62.37113% with 73 lines in your changes missing coverage. Please review.

Project coverage is 52.40%. Comparing base (d7ac3a8) to head (8bf9f2e).
Report is 1207 commits behind head on master.

Files with missing lines Patch % Lines
enterprise/suppress-user/factory.go 69.12% 32 Missing and 14 partials ⚠️
enterprise/suppress-user/repo_switch.go 28.57% 20 Missing ⚠️
...rprise/suppress-user/internal/badgerdb/badgerdb.go 58.82% 5 Missing and 2 partials ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

3 participants