Demote PG::ReadOnlySqlTransaction in gitlab:db:validate_config from ERROR to WARNING
Release notes
In GitLab 15.1.0 we introduced additional handling of an error when doing an upsert on a read-only database. When a user encounters this scenario, they are presented with a message stating "ERROR: cannot execute INSERT in a read-only transaction". The verbiage is confusing to users because it implies it is ERROR
severity, but it should be a WARNING
since this does not break anything or halt any processes.
Problem to solve
When running the gitlab:db:validate_config
migration on a read-only Geo secondary, the task appears to fail with the message
WARNING: Could not write to the database main: PG::ReadOnlySqlTransaction: ERROR: cannot execute INSERT in a read-only transaction
The verbiage is confusing here since the message is WARNING severity but includes an additional ERROR message that may confuse users. This behavior is actually expectd since a Geo secondary site will always be read-only, and will not allow an INSERT statement.
Intended users
This change primarily affects Sidney, who would be responsible for executing this task in a Geo environment. When presented with this message, they may be inclined to open a ticket with GitLab Support for assistance with resolving the issue. Since this is a warning and is expected behavior, we can deflect this interaction and preserve GitLab Support resources by adjusting the verbiage to be more clear.
User experience goal
Sidney should not be presented with a message that contains conflicting information. This may cause unnecessary confusion, leading them to believe that a database migration was unsuccessful and needs action.
Instead, Sidney should feel confident that they understand the information presented to them is accurate and meaningful.
Proposal
In order to solve this, we should do one of the following:
- Change the string "ERROR" to "WARNING"
WARNING: Could not write to the database main: PG::ReadOnlySqlTransaction: WARNING: cannot execute INSERT in a read-only transaction
- Remove the second severity completely
WARNING: Could not write to the database main: PG::ReadOnlySqlTransaction: cannot execute INSERT in a read-only transaction
Further details
This occurs most recently when upgrading from GitLab 15.1.2 to 15.2.x. If you wish to reproduce, perhaps the most obvious way is to perform a zero downtime upgrade on Geo.
Permissions and Security
Documentation
Once this is fixed, we should also add a description of the message and its impact in the Geo troubleshooting document.
Available Tier
Premium Self-Managed