Skip to content

Add Cop that enforces worker data_consistency [RUN AS-IF-FOSS]

Matthias Käppler requested to merge 334495-enforce-worker-data-consistency into master

Replaces https://gitlab.com/gitlab-org/gitlab-styles/-/merge_requests/84

Description of the proposal

We recently introduced database load balancing for Sidekiq workers. To utilize this, one has to first set a desired data_consistency setting in the worker: https://docs.gitlab.com/ee/development/sidekiq_style_guide.html#job-data-consistency-strategies

In order to push adoption of SK load balancing further and to nudge developers to make conscious trade-offs here, we hope to maximize the opportunities for directing traffic away from the database primary, which by default all Sidekiq workers would otherwise query.

Fixing existing cops

Happening in this MR: !65427 (merged)

Check-list

  • Make sure this MR enables a static analysis check rule for new usage but ignores current offenses
  • Mention this proposal in the relevant Slack channels (e.g. #development, #backend, #frontend)
  • If there is a choice to make between two potential styles, set up an emoji vote in the MR:
    • CHOICE_A: 🅰
    • CHOICE_B: 🅱
    • Vote yourself for both choices so that people know these are the choices
  • The MR doesn't have significant objections, and is getting a majority of 👍 vs 👎 (remember that we don't need to reach a consensus)
  • (If applicable) One style is getting a majority of vote (compared to the other choice)
  • (If applicable) Update the MR with the chosen style
  • Create a follow-up issue to fix the current offenses as a separate iteration: #335170 (closed)
  • Follow the review process as usual
  • Once approved and merged by a maintainer, mention it again:
    • In the relevant Slack channels (e.g. #development, #backend, #frontend)
    • (Optional depending on the impact of the change) In the Engineering Week in Review

/cc @gitlab-org/maintainers/rails-backend

Edited by Matthias Käppler

Merge request reports