Skip to content

Fix sticking of the database load balancer

Yorick Peterse requested to merge fix-load-balancer-sticking into master

This fixes sticking when database load balancing is used. From the commit:

Fix sticking of the database load balancer

There were 3 problems with sticking:

  1. When sticking to a request (based on a previous request) we would always overwrite the WAL pointer, leading to a user being stuck to the primary for too long.

  2. Sticking was not working for the Grape API. The API in particular is tricky because we have to stick either using a user, CI runner, or a CI build.

  3. Refreshing of permissions did not lead to the refreshed users being stuck to the primary. This could result in users not being able to access new resources for a brief moment of time, or them still being able to see old resources.

To solve this some of the Grape related logic is handled by injecting EE specific modules in the right places. This ensures we can stick as early as possible, using the right data. The same technique is applied for various parts of the CI codebase.


  • Fix the terrible proxy module code
  • Patch Ci::Build so status changes result in the build being stuck to the primary
  • Tests for Sticking
  • Update tests for RackMiddleware
  • Test Grape API calls
  • Test CI runner API calls
  • Test CI build API calls
  • Test refreshing of permissions

Merge request reports