[Feature flag] Transition Sidekiq duplicate jobs to RedisSharedState
Summary
This issue is to rollout the transition of Sidekiq duplicate jobs data to SharedState on production,
that is currently behind the use_primary_and_secondary_stores_for_duplicate_jobs
and use_primary_store_as_default_for_duplicate_jobs
feature flags.
Owners
- Team: groupscalability
- Most appropriate slack channel to reach out to:
#scalability-423-sidekiq-zonal-clusters
- Best individual to reach out to: @alejandro
- PM: @lmcandrew
Stakeholders
Expectations
What are we expecting to happen?
- We enable
use_primary_and_secondary_stores_for_duplicate_jobs
. Data is written to both the Sidekiq store and the SharedState store. SomeReadFromPrimaryError
andPipelinedDiffError
errors are expected and normal at this stage. -
ReadFromPrimaryError
andPipelinedDiffError
errors disappear after a short period of time. We should wait at least 6 hours, the default TTL for keys related to this feature before proceeding (note: scheduled jobs may have a different TTL). - We enable
use_primary_store_as_default_for_duplicate_jobs
. SharedState becomes the main store. There are noReadFromPrimaryError
norPipelinedDiffError
errors. - We disable
use_primary_and_secondary_stores_for_duplicate_jobs
. TheSidekiq
store stops being used completely. - Transition is complete. An MR to remove the
MultiStore
and makeSharedState
the only store should follow.
When is the feature viable?
None
What might happen if this goes wrong?
-
MultiStore
could have a breaking bug, causing widespread errors. Disabling both flags bypassesMultiStore
and returns to the old status quo - If
ReadFromPrimaryError
andPipelinedDiffError
persist after 6 hours but functionality is unaffected, duplicate jobs data may not be persisted correctly toSharedState
. Thus we wouldn't be able to continue with the transition, we should disable both flags and investigate.
What can we monitor to detect problems with this?
- Sidekiq: Overview - https://dashboards.gitlab.net/d/sidekiq-main/sidekiq-overview?orgId=1. Note especially Service Apdex, Service Error Ratio, and Queue lengths
What can we check for monitoring production after rollouts?
- Messages with
instance_name: DuplicateJobs
: - Jobs with
job_status: deduplicated
https://log.gprd.gitlab.net/goto/9d6ad1f0-e584-11ec-aade-19e9974a7229. Be on the lookout for abrupt increases or decreases in volume after changing the feature flags. Unrestrained growth or a drop to zero should immediately trigger a rollback.
Rollout Steps
Rollout on non-production environments
- Ensure that the feature MRs have been deployed to non-production environments.
-
/chatops run auto_deploy status fb70b258
-
-
Enable use_primary_and_secondary_stores_for_duplicate_jobs
globally on non-production environments.-
/chatops run feature set use_primary_and_secondary_stores_for_duplicate_jobs true --dev
-
/chatops run feature set use_primary_and_secondary_stores_for_duplicate_jobs true --staging
-
-
Verify that the feature works as expected. -
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
, andgitlab_redis_multi_store_read_fallback_total
. After at most 6 hours, they should both be zero. Also monitorgitlab_redis_multi_store_method_missing_total
. It should always be zero. Link to Thanos
-
-
Enable use_primary_store_as_default_for_duplicate_jobs
globally on non-production environments.-
/chatops run feature set use_primary_store_as_default_for_duplicate_jobs true --dev
-
/chatops run feature set use_primary_store_as_default_for_duplicate_jobs true --staging
-
-
Verify that the feature works as expected. -
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
,gitlab_redis_multi_store_read_fallback_total
, andgitlab_redis_multi_store_method_missing_total
. They should all be zero. Link to Thanos
-
-
Disable use_primary_and_secondary_stores_for_duplicate_jobs
globally on non-production environments, so that SharedState is used as the default store.-
/chatops run feature set use_primary_and_secondary_stores_for_duplicate_jobs false --dev --staging
-
-
Verify that the feature works as expected. -
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
,gitlab_redis_multi_store_read_fallback_total
, andgitlab_redis_multi_store_method_missing_total
. They should all be zero. Link to Thanos
-
Specific rollout on production
- Ensure that the feature MRs have been deployed to both production and canary.
-
/chatops run auto_deploy status <merge-commit-of-your-feature>
-
- If you're using project-actor, you must enable the feature on these entries:
-
/chatops run feature set --project=gitlab-org/gitlab,gitlab-org/gitlab-foss,gitlab-com/www-gitlab-com <feature-flag-name> true
-
- If you're using group-actor, you must enable the feature on these entries:
-
/chatops run feature set --group=gitlab-org,gitlab-com <feature-flag-name> true
-
- If you're using user-actor, you must enable the feature on these entries:
-
/chatops run feature set --user=<your-username> <feature-flag-name> true
-
-
Verify that the feature works on the specific entries. Posting the QA result in this issue is preferable.
Preparation before global rollout
-
Check if the feature flag change needs to be accompanied with a change management issue. Cross link the issue here if it does. -
Ensure that you or a representative in development can be available for at least 2 hours after feature flag updates in production. If a different developer will be covering, or an exception is needed, please inform the oncall SRE by using the @sre-oncall
Slack alias. -
Ensure that documentation has been updated (More info). -
Announce on the feature issue an estimated time this will be enabled on GitLab.com. -
Ensure that any breaking changes have been announced following the release post process to ensure GitLab customers are aware. -
Notify #support_gitlab-com
and your team channel (more guidance when this is necessary in the dev docs).
Global rollout on production
For visibility, all /chatops
commands that target production should be executed in the #production
slack channel and cross-posted (with the command results) to the responsible team's slack channel (#g_TEAM_NAME
).
- Ensure that the feature MRs have been deployed to non-production environments.
-
/chatops run auto_deploy status [id of your commit]
-
- Enable
use_primary_and_secondary_stores_for_duplicate_jobs
globally on non-production environments.-
/chatops run feature set use_primary_and_secondary_stores_for_duplicate_jobs true
-
- Verify that the feature works as expected.
-
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
, andgitlab_redis_multi_store_read_fallback_total
. After at most 6 hours, they should both be zero. Also monitorgitlab_redis_multi_store_method_missing_total
. It should always be zero. Link to Thanos
-
- Enable
use_primary_store_as_default_for_duplicate_jobs
globally on non-production environments.-
/chatops run feature set use_primary_store_as_default_for_duplicate_jobs true
-
- Verify that the feature works as expected.
-
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
,gitlab_redis_multi_store_read_fallback_total
, andgitlab_redis_multi_store_method_missing_total
. They should all be zero. Link to Thanos
-
- Disable
use_primary_and_secondary_stores_for_duplicate_jobs
globally on non-production environments, so that SharedState is used as the default store.-
/chatops run feature set use_primary_and_secondary_stores_for_duplicate_jobs false
-
- Verify that the feature works as expected.
-
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
,gitlab_redis_multi_store_read_fallback_total
, andgitlab_redis_multi_store_method_missing_total
. They should all be zero. Link to Thanos
-
-
Announce on the feature issue that the feature has been globally enabled. -
Wait for at least one day for the verification term.
(Optional) Release the feature with the feature flag
If you're still unsure whether the feature is deemed stable but want to release it in the current milestone, you can change the default state of the feature flag to be enabled. To do so, follow these steps:
-
Create a merge request with the following changes. Ask for review and merge it. -
Set the default_enabled
attribute in the feature flag definition totrue
. -
Create a changelog entry.
-
-
Ensure that the default-enabling MR has been included in the release package. If the merge request was deployed before the monthly release was tagged, the feature can be officially announced in a release blog post. -
/chatops run release check <merge-request-url> <milestone>
-
-
Consider cleaning up the feature flag from all environments by running these chatops command in #production
channel. Otherwise these settings may override the default enabled.-
/chatops run feature delete <feature-flag-name> --dev
-
/chatops run feature delete <feature-flag-name> --staging
-
/chatops run feature delete <feature-flag-name>
-
-
Close the feature issue to indicate the feature will be released in the current milestone. -
Set the next milestone to this rollout issue for scheduling the flag removal. -
(Optional) You can create a separate issue for scheduling the steps below to Release the feature. -
Set the title to "[Feature flag] Cleanup <feature-flag-name>
". -
Execute the /copy_metadata <this-rollout-issue-link>
quick action to copy the labels from this rollout issue. -
Link this rollout issue as a related issue. -
Close this rollout issue.
-
WARNING: This approach has the downside that it makes it difficult for us to clean up the flag. For example, on-premise users could disable the feature on their GitLab instance. But when you remove the flag at some point, they suddenly see the feature as enabled and they can't roll it back to the previous behavior. To avoid this potential breaking change, use this approach only for urgent matters.
Release the feature
After the feature has been deemed stable, the clean up should be done as soon as possible to permanently enable the feature and reduce complexity in the codebase.
You can either create a follow-up issue for Feature Flag Cleanup or use the checklist below in this same issue.
-
Create a merge request to remove <feature-flag-name>
feature flag. Ask for review and merge it.-
Remove all references to the feature flag from the codebase. -
Remove the YAML definitions for the feature from the repository. -
Create a changelog entry.
-
-
Ensure that the cleanup MR has been included in the release package. If the merge request was deployed before the monthly release was tagged, the feature can be officially announced in a release blog post. -
/chatops run release check <merge-request-url> <milestone>
-
-
Close the feature issue to indicate the feature will be released in the current milestone. -
If not already done, clean up the feature flag from all environments by running these chatops command in #production
channel:-
/chatops run feature delete <feature-flag-name> --dev
-
/chatops run feature delete <feature-flag-name> --staging
-
/chatops run feature delete <feature-flag-name>
-
-
Close this rollout issue.
Rollback Steps
- Enable
use_primary_and_secondary_stores_for_duplicate_jobs
, so that we go back to using both stores.-
/chatops run feature set use_primary_and_secondary_stores_for_duplicate_jobs true
-
- Verify that the feature works as expected.
-
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
, andgitlab_redis_multi_store_read_fallback_total
. After at most 6 hours, they should both be zero. Also monitorgitlab_redis_multi_store_method_missing_total
. It should always be zero. Link to Thanos
-
- Disble
use_primary_store_as_default_for_duplicate_jobs
to go back to using the Queues store as the primary-
/chatops run feature set use_primary_store_as_default_for_duplicate_jobs false
-
- Verify that the feature works as expected.
-
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
,gitlab_redis_multi_store_read_fallback_total
, andgitlab_redis_multi_store_method_missing_total
. They should all be zero. Link to Thanos
-
- Disable
use_primary_and_secondary_stores_for_duplicate_jobs
so that Queues is the only store used-
/chatops run feature set use_primary_and_secondary_stores_for_duplicate_jobs false
-
- Verify that the feature works as expected.
-
Monitor the Prometheus metrics gitlab_redis_multi_store_pipelined_diff_error_total
,gitlab_redis_multi_store_read_fallback_total
, andgitlab_redis_multi_store_method_missing_total
. They should all be zero. Link to Thanos
-