Skip to content

Prevent unnecessary sticking to the DB primary when recording experiments

What does this MR do?

Experiments can be run on high-traffic read-only pages and when a transaction is initiated, our load balancing code will direct all queries to the primary.

This update is a no-op most of the time so we skip the update when we detect that the attributes haven't changed.

ActiveRecord actually already does this under the hood but a #transaction call is still made in the process causing the undesired behavior with our load balancer.

More details in #324649 (closed)

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Heinrich Lee Yu

Merge request reports