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:
- Q: Why env variable was used instead of a feature flag?
- Q: Where did we monitor the errors to decide on removing this env variable?
How to set up and validate locally
The existing spec (introduced in !90447 (merged)) validates the expected behaviour.
But to test further,
- Unset the local ENV variable (PREVENT_LOAD_BALANCER_RETRIES_IN_TRANSACTION).
- Open rails console and run
ApplicationRecord.transaction { ApplicationRecord.connection.execute('select pg_sleep(20)'); }
- 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();
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #385370 (closed)
Edited by Prabakaran Murugesan