Fix spec that introduces transaction timeout on Ruby 3.0.2
What does this MR do?
This is extracted from Ruby 3.0.2 branch.
These specs are having a timeout on Ruby 3.0.2 while working just fine on Ruby 2.7.
Rewriting the way how we obtain a separate connection (via a dedicated API instead of stubbing the const) resolves the issue.
Although I am not sure I understand the very root cause of the issue, so database expert help would be appreciated a lot.
How to setup and validate locally (strongly suggested)
Switch to Ruby **3.0.2 **in GDK.
Run bin/spring rspec spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb
or/and bin/spring rspec spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb
. They would be stuck on master
after executing this line https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/lib/gitlab/database/with_lock_retries_outside_transaction_spec.rb#L190.
Applying the fixes on this branch, you are able to run the spec both on Ruby 3 on Ruby 2.7.
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
N/A - it's a spec
Security
N/A