Skip to content

Cleaning up PREVENT_LOAD_BALANCER_RETRIES_IN_TRANSACTION env var

What does this MR do and why?

The ENV variable (PREVENT_LOAD_BALANCER_RETRIES_IN_TRANSACTION) was introduced for an incremental rollout of the fix for #220242 (closed). Since this is in production for enough period without any issues, this MR removes the ENV variable by defaulting to 'true'.

Q/A:

How to set up and validate locally

The existing spec (introduced in !90447 (merged)) validates the expected behaviour.

But to test further,

  1. Unset the local ENV variable (PREVENT_LOAD_BALANCER_RETRIES_IN_TRANSACTION).
  2. Open rails console and run
    ApplicationRecord.transaction { ApplicationRecord.connection.execute('select pg_sleep(20)'); }
  3. Open a psql and run the below query within the first 20secs,
    SELECT pg_terminate_backend(pg_stat_activity.pid)                                                                                                                                  
    FROM pg_stat_activity                                                                                                                                                                                     
    WHERE pg_stat_activity.datname = current_database()                                                                                                                                                       
    AND pid <> pg_backend_pid();
  4. The transaction in rails console will rollback and retried once as a whole.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #385370 (closed)

Edited by Prabakaran Murugesan

Merge request reports

Loading